Although this period coincided with a resurgence of nationalism and patriotism, it was the shift of the economy from feudalism to mercantilism, and the opportunities that came with Age of Exploration and establishing colonies abroad, that most influenced the consolidation of power in Europe during this time. Monarchs suddenly had ways to greatly increase their revenue by taxing trade and by reaping the benefits of overseas colonies, which took a lot of power away from feudal lords.
The Mexican army attacked them. The main cause of the war was the westward expansion of the United States. All through the 19th century Americans believed it was their right to expand westward. At the time they believed they could conquer the people already living on the land and take it for the United States.