was captured by the United States during the U.S.-Mexico War of 1846.
The American flag was first raised in the Mexican capital of Monterey on
July 6 1846 by Commodore John Sloat of the U.S.S. Congress.
Three days later it was raised in San Francisco by Captain John
Montgomery of the U.S.S. Portsmouth.
At that time, the Yerba Buena Cove came inland as far as where Montgomery Street is today. The flag pole was in front of the Mexican Customs House, where Portsmouth Square is today.
Above is a 19th century drawing of the flag raising in San Francisco. The artist took a couple of liberties: in reality the cove was too shallow for a ship of this size to get so close, and the Customs House and flag pole were approximately one block farther inland. The cove was later filled in, using sand from hills that were leveled. (Yes, there were many more hills then than there are now!). Today, Montgomery Street runs approximately where this shoreline is, and the bay is 6 blocks east of Montgomery Street. The hill in the background is meant to be Telegraph Hill.
Below, a flagpole with commemorative marker in todays Portsmouth Square.
Sorry, there is not a prize for guessing how Portsmouth Square and Montgomery Street got their names. (See above for clues.)
For a first-person account see Raising the flag.