Constructed in 1827 by the Mexican government to collect custom duties from foreign shipping, a principal revenue source when Monterey was the capital of Alta California, Mexico's northernmost province, the Custom House was rebuilt and enlarged in 1841 under a contract between the Mexican government and Thomas O. Larkin, U.S. consul to Alta California. Commodore John Drake Sloat raised the American flag over the building on July 7, 1846, signaling the passing of California from Mexican to American rule. It was later restored through the efforts of the Native Sons of the Golden West with the assistance of the people of California.