One day in 1818, a Spanish lookout in Monterey saw a pair of mysterious vessels approaching. The Spanish had been warned that enemy ships were planning to attack California, and the commander of the Presidio immediately ordered his troops to muster at a gun battery overlooking the harbor.

For the first and only time, a California fort was about to engage in a gunbattle with enemy ships.

As recounted in the last Portals, the attack on Monterey was part of Latin American wars of independence that were racking the declining Spanish empire in the early 19th century. The two ships were commanded by a Frenchman named Hipolito Bouchard, who was fighting for newly independent Argentina.

Bouchard was a privateer — a legal pirate — whose orders were to attack the Spanish in any way he saw fit. After an unsuccessful assault on the Spanish-controlled Philippines, he had sailed to Hawaii, where an Englishman named Peter Corney persuaded him to attack Monterey. Bouchard seized a second warship, put Corney in command of it and sailed for California.

The capital of Spanish Alta California, like the entire province, was easy pickings. There wasn’t much to pick, but Bouchard didn’t know that. Monterey had only 400 inhabitants, almost all of whom lived inside the walls of the Presidio, a walled community 385 feet square and containing about 50 adobe buildings.

Monterey’s garrison consisted of about 65 poorly equipped troops. Its gun battery, El Castillo, consisted of eight cannons mounted on a bluff, vulnerable to attack from its open rear.

Bouchard’s force of 360 men was a motley assortment of adventurers. As Peter Uhrowczik writes in “The Burning of Monterey,” it was composed of 80 kanakas, or Hawaiians, along with “Americans, Spaniards, Portuguese, Creoles, Negroes, Manila men, Malayans, and a few Englishmen.”

At midnight on Nov. 20, 1818, Corney anchored his ship, the Santa Rosa, less than a quarter mile from the fort and informed the Spanish that he and his men would deliver their papers in the morning. Meanwhile, Bouchard ordered an officer to land with 200 men and capture the fort under cover of darkness, but for unknown reasons, the attack was never carried out.

Corney left his ship anchored near the fort overnight, apparently believing its cannons would be ineffective. However, as dawn approached, he realized that the battery was fully manned and opened fire. Two shore batteries, one at El Castillo and one on the beach, answered.

During the two-hour battle, the Santa Rosa was hit repeatedly. Five men died, and Corney and most of the other crew members fled in boats. No one ashore was killed.

The Spanish commander and governor of Alta California, Pablo Vicente de Sola, ordered the Santa Rosa’s commander to come ashore. But only the ship’s second-in-command, an American named Joseph Chapman, along with a sailor from Guinea and one from Buenos Aires, obeyed. Dissatisfied with their “lies and frivolous excuses,” Sola had them imprisoned.

At this point, the battle came to a halt. Although most of the crew of the Santa Rosa had fled, the Spanish did not try to board it. Sola later explained that he didn’t have enough men or ammunition.

The relieved Bouchard, anchored 2 miles away, tried to buy time by sending an emissary ashore asking Sola to surrender. Sola angrily refused.

That night, taking advantage of a victory dance at the fort, Bouchard sent boats to rescue the remaining crew of the Santa Rosa. Then, at 8 a.m. on Nov. 22, he led 200 men and nine boats ashore at what is now Lovers Point.

A total of 138 men were armed with muskets — the rest carried spears. The invaders advanced through low brush, passing near the current site of Cannery Row and the Monterey Bay Aquarium. They met no resistance and by 10 a.m. occupied El Castillo. As the Spaniards fled on horseback, a group of spear-carrying Hawaiians hauled down the royal flag of Spain.

The Spanish made a feeble stand at the Presidio, but it fell after a short fight, during which neither side suffered any casualties. Sola and his troops retreated to Rancho del Rey, 13 miles away. The civilian inhabitants of the Presidio had already fled, in such haste that most were barefoot.

When Bouchard’s troops entered the Presidio, they found only one person, a drunken settler named Molina. He would be the only prisoner Bouchard would take in Alta California. The invaders sacked the houses in the Presidio, searching for valuables and money, mostly without success. Then they burned several dwellings, but left the Presidio church and Carmel mission unscathed.

Bouchard stayed in Monterey for about five days, then sailed to Rancho del Refugio, 23 miles north of Santa Barbara. While plundering the ranch, three men wandered off and were lassoed by the locals. The enraged Bouchard sailed to Santa Barbara, where he retrieved the three prisoners in exchange for not burning the town.

Bouchard concluded his assault on Alta California by plundering and burning San Juan Capistrano, after which he sailed back to Latin America.

Bouchard’s raid had no effect on the fate of Alta California, although it did increase its Anglo population from three to five people, thanks to Joseph Chapman, who remained imprisoned in Monterey, and a Scottish drummer named John Ross, who deserted at San Juan Capistrano. The Spanish viceroy sent 200 additional soldiers to the remote province, but many of them were criminals and lowlifes who became known derisively as “cholos.” In 1821, Alta California became part of the independent nation of Mexico.

As for Bouchard, he died as violently as he had lived. After many adventures, he ended up as commander of the Peruvian navy. He retired in his 50s and spent his last years as a gentleman farmer, growing grapes for brandy. At the age of 57, he was killed by his slaves, for reasons unknown. Bouchard is regarded as a national hero in Argentina.

Gary Kamiya is the author of the best-selling book “Cool Gray City of Love: 49 Views of San Francisco,” awarded the Northern California Book Award in creative nonfiction. All the material in Portals of the Past is original for The San Francisco Chronicle. Email: metro@sfchronicle.com

Trivia time

Previous trivia question: What did guitarists Jerry Garcia and Django Reinhardt have in common?

Answer: Garcia lost most of a finger in a childhood accident; Reinhardt lost two fingers in a fire.

This week’s trivia question: Who called WACO, the community organization created to protest the redevelopment of the Western Addition, “a passing flurry of proletarianism”?

Editor’s note

Every corner in San Francisco has an astonishing story to tell. Gary Kamiya’s Portals of the Past tells those lost stories, using a specific location to illuminate San Francisco’s extraordinary history — from the days when giant mammoths wandered through what is now North Beach to the Gold Rush delirium, the dot-com madness and beyond. His column appears every other Saturday, alternating with Peter Hartlaub’s OurSF.