On Oct. 19, 1842 a squadron of ships under the command of Commodore Thomas Ap Catesby Jones sailed into the harbor at Monterey, California, then a Mexican city. Under the guns of the fort that overlooked the harbor, the sailors made the ship cannons ready for a fierce fight.
Meanwhile, Marines and sailors formed a landing party under Commander James Armstrong. The small force made its way to shore, searched out the local governor, and demanded the city. The governor indicated he would surrender the entire province in the morning.
Sailors spent a tense night manning the guns in case it was a trick, but the governor and his commissioners arrived the next morning at the heavy frigate USS United States — Jones's flagship — and signed the articles of capitulation.
Commodore Jones had ordered the fleet to Monterey and the subsequent invasion because he was worried that the British would use the war between Mexico and America as a chance to capture coveted Pacific ports in California. Jones had raced to Monterey to arrive ahead of the British.
Jones's men immediately moved into the fort and prepared to defend it from the coming British attack.
In Jones's defense, he had been in a tough spot. Relations between the two countries had been souring and he had received news of British ships moving up the coast of South America in force. Jones was under orders to capture Californian ports rather than let them fall into British or French hands in case of a war with Mexico.
The problem in 1842 was that Jones wouldn't get a satellite or radio call telling him when war broke out. He had to figure out himself.
Then he jumped the gun a little bit and invaded prematurely. It happens. The commodore realized his mistake when an American businessman in Monterey brought him a number of recent newspapers from the U.S. that made no mention of hostilities. Can you imagine having that bad of a day at work? "Uh hey, boss. I captured a Mexican city by accident". Cringe.
After realizing his error, Jones gave the city back to Mexico and told his men to stand down. The Mexican flag was raised over the fort once again.
To try and patch relations, the Mexican and American officials at Monterey began hosting parties for one another while their respective national governments launched investigations.
Luckily, the Marines and soldiers had behaved themselves so well during the occupation that the locals were actually fond of the them.
Unfortunately, word was already making its way up the coast that American ships had captured Monterey as part of a war with Mexico. Another U.S. Navy officer, Captain W. D. Phelps, then captured Fort Guijarros at San Diego, California and spiked its guns.