the judicial branch makes sure the law is constitutional (confirmed by this passage the most important part of the judicial branch is the Supreme Court. The Supreme Court's role is to interpret the Constitution and limit the powers of the other branches of government.) not taking credit for passage / the legislative branch creates laws /and the executive branch enforces the laws.
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.