MEXICO CITY (AP) — President Felipe Calderon on Monday criticized both Americans and Mexicans for their roles in the 1846-1848 war that cost Mexico half its territory during a ceremony commemorating the definitive battle of the conflict.

Speaking on the 163rd anniversary of the Battle of Chapultepec, Calderon called the war an "unjust military aggression motivated by clearly imperialistic interests."

Mexico lost about half its territory to the United States in the war, including much of what later became Arizona, Nevada, Utah and California.

But Calderon also said Mexicans deserved some blame.

"We lost because of the invasion and expansionist desires of our enemy, but also because of divisions among Mexicans," the president said, noting a widely cited theory that Gen. Antonio Lopez de Santa Anna refused to send reinforcements to another general because of bad blood between the two, contributing to a key U.S. victory that allowed the invading troops to advance to Chapultepec.

"Thus, while many Mexicans fought to the death in the war with the United States, others simply watched the American troops go by without standing up to them," Calderon said.

"We only prosper when we are united," Calderon told the crowd as Mexico prepares to celebrate the bicentennial of its 1810 independence Wednesday and Thursday. "That is the great lesson of our history."

Even though Mexico lost at Chapultepec, on a hill overlooking the capital, the battle produced a symbol of national pride.

According to traditional accounts, six cadets — the "child heroes" — fought to the death rather than surrender to invading U.S. troops. One is said to have wrapped himself in a Mexican flag and leaped to his death from the battlements.