qnli question: How long was the war? sentence: Mexico's independence from Spain was effectively declared in the Declaration of Independence of the Mexican Empire on September 27, 1821, after a decade of war.