CASTINE, Maine — It is called the War of 1812, but it might as be called the War of 1814 when it comes to the coast of Maine.

During that summer and fall 200 years ago, the powerful Royal Navy of the British Empire descended upon communities such as Eastport, Machias and Castine, all of which were still part of Massachusetts at the time. British forces controlled much of the coast between Penobscot and Cobscook bays for nearly a year, raiding towns along the Penobscot River and attacking Hampden and Bangor before returning to Castine.

Though war had been declared two years earlier, divided support for the conflict in the United States and the ongoing Napoleonic Wars in Europe kept much of the fighting to a simmer in the early years — not including a pitched naval battle off Monhegan in September 1813, in which the American ship Enterprise defeated and captured the British ship Boxer.

Initial support for the war was weakest in New England, where the Federalist party favored strong ties with Britain and merchants conducted significant trade with Britain’s Canadian colonies.

Story continues below advertisement.

In Castine, prior to the eight-month British occupation, town officials condemned the declaration of war and held a dim view of President James Madison and his predecessor, Thomas Jefferson — Republicans whom they felt were “anti-commerce” and “anti-New England,” according to Lynn Parsons, a retired history professor from Brockport, New York, who now lives in Castine.

“The War of 1812 disrupted [trans-Atlantic trade],” Parsons said recently.

In the summer of 1814, after Napoleon’s defeat at the Battle of Leipzig, the conflict heated up in eastern Maine. The British ramped up their efforts in America and sailed into several eastern Maine ports with little to no resistance. First Eastport, then Castine, Hampden, Bangor and Machias were attacked or taken over by the British who, according to Parsons, regretted not holding onto the eastern shore of the Penobscot River at the end of the Revolutionary War.

“They thought they had made a mistake,” Parsons said. Had the War of 1812 ended differently, he added, “this part of Maine could have wound up as part of Canada.”

In early July, a flotilla of British ships, including the bomb ship HMS Terror, sailed into Passamaquoddy Bay. The British formally took control of Fort Sullivan, the town of Eastport and all the islands and villages in the bay, according to “The Pictoral History of the War of 1812,” by Benson John Lossing. Eight hundreds soldiers were left in Eastport, and fortifications, including 60 cannons, were built around the town, which remained under British control for the remainder of the war.

In September, the Terror took part in the battle at Fort McHenry in Maryland, which inspired the “Star Spangled Banner.”

As the war flared up in 1814, its end already was being negotiated in the then-Dutch city of Ghent, where American and British officials met in secret. The decline of hostilities in Europe undercut the rationale for war in America, and neither side was eager for a repeat of the Revolutionary War, which ended only three decades earlier.

“I think both sides decided in the long run it wasn’t really worth it,” Parsons said.

The following spring — less than a year after they arrived — the British left Castine and the Down East shore, sailing back to their Canadian colonies east of the Saint Croix River and across the Gulf of Maine.

The war may have pitted the young United States against its former master, but the divisions it exacerbated between Massachusetts and residents who lived east of New Hampshire may have left a more lasting legacy.

The reluctance of Massachusetts officials to come to the aid of its occupied eastern outposts during the war led to calls for secession from the Bay State — which, according to Parsons, were not strongly resisted in Boston. In 1820, five years after the British departed, Maine would become the nation’s 23rd state as part of the Missouri Compromise.

“There was a lot of resentment” in the Maine district toward Massachusetts, even before the war, Parsons said. “This just made things worse.”

The war, which marked the end of 200 years of contested control of the Castine peninsula, is being remembered this summer with an exhibit by the Castine Historical Society. It is also the subject of the society’s annual Pulliam lecture, scheduled for Aug. 5 at Maine Maritime Academy.