The Mexican-American War was a conflict between the United States and Mexico, ending in February. Won by the Americans and damned by its contemporary critics as expansionist, it resulted in the U.S. gaining more than 500,000 square miles (1,300,000 square km) of Mexican territory extending westward from the Rio Grande to the Pacific Ocean. It stemmed from the annexation of the Republic of Texas by the U.S. in 1845 and from a dispute over whether Texas ended at the Nueces River (the Mexican claim) or the Rio Grande (the U.S. claim). In Gonzales, W.V. Collins began a brick yard and, securing the contract to build a courthouse, he used his own bricks; completed courthouse 1849; which cost $3,000. Population of Gonzales grew to about 350.