
Britain and the United States had been at war since 1812 - and some have referred to it as the second war of independence. A brief outline of the two and a half year war can be found at http://www.usahistory.com/wars/1812.htm
The attack on the new capital was a retaliation for the attack by American forces on York (now Toronto) in Canada on April 27, 1813. The Americans attacked with a fleet of fourteen ships via the York Harbour. The Parliament Building was looted, and then burned down.
After Washington was attacked British forces moved on to Baltimore. An observer of the attack launched upon Fort McHenry (a fort which was vital to Baltimore's defence) wrote a poem about the failure of the sustained bombardment on the fort - "The Star Spangled Banner" now the American national anthem.