The U.S. Navy Band and Her Majesty's Royal Marines Band of Great Britain perform jointly during the commemoration Monday of the 200th anniversary of the declaration of the War of 1812, at Fort McHenry, Md. on June 18, 2012. (Steve Vogel/The Washington Post)

Representatives of the United States, Britain and Canada marked the 200th anniversary of the start of the War of 1812 during a ceremony Monday at Baltimore’s Fort McHenry, with the former enemies mixing pledges of comity with sly digs.

The leaders of all three nations addressed the commemoration in recorded video messages.

“In many ways, the War of 1812 helped define our young nation,” President Obama said during his taped remarks.

Canadian Prime Minister Stephen Harper likewise termed the war a “defining moment” in that nation’s history, but lamented the “bloody and sad days . . . dividing those who had so much in common.”

On June 18, 1812, President James Madison signed a declaration of war against Britain, after a bitterly divided Congress approved war in the closest such vote in U.S. history. Soon after the declaration, the United States launched a series of unsuccessful invasions of Canada, which then consisted of the colonies making up British North America.

Monday’s ceremony, entitled “From Enemies to Allies: 200 Years of Peace,” highlighted the subsequent relations between the three nations, including during World War I, World War II and the war in Afghanistan, where troops from the United States, Canada and Britain fought together.

The event, launched with a booming ceremonial cannon salute fired by the water battery at Fort McHenry, formally begins a three-year bicentennial commemoration for the war. It was held in a light rain along the water battery below the fort’s ramparts and towering American flag.

Hundreds of umbrella-toting spectators listened to music from military bands and choirs, and speeches from dignitaries, including the ambassadors from Great Britain and Canada.

“I must admit, when I visited the White House earlier this year, I was a bit embarrassed that my ancestors had managed to burn the place down 200 years ago,” British Prime Minister David Cameron said in his recorded video address.

But, Cameron added, “You can thank the British for your national anthem,” a reference to the writing of “The Star-Spangled Banner” by Francis Scott Key during the unsuccessful British bombardment of Fort McHenry in September 1814.

Navy Secretary Ray Mabus, whose Pentagon office is decorated with depictions of American victories at sea during the War of 1812, told the crowd that Adm. Sir Mark Stanhope, Britain’s First Sea Lord, “ruefully” notes during his visits that “he is surrounded by paintings of burning British ships.”

Mabus added, “And he is.”

All the nations involved claim some measure of victory in the war. Mabus noted that the United States and Canada regard the war “as great victories, so it’s fitting we’re here celebrating as friends.”

Monday’s ceremony was part of the week-long “Star-Spangled Sailabration” that has drawn hundreds of thousands of visitors to Baltimore.