The Mexican–American War was an armed conflict between the United States of America and Mexico from 1846 to 1848. It followed in the wake of the 1845 American annexation of the independent Republic of Texas, which Mexico still considered its northeastern province and a part of its territory after its de facto secession in the 1836 Texas Revolution a decade earlier.