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 part of Mexico. Under the guns of the Mexican fort that overlooked the harbor, the sailors made the ship cannons ready for a fierce fight.
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.
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.