LONDON >> Britain and the European Union struck a landmark deal Monday to remove some post-Brexit trade barriers and to bolster cooperation on security and defense as they reduce their reliance on an unpredictable United States.

The agreement, unveiled by Prime Minister Keir Starmer of Britain and Ursula von der Leyen, president of the European Commission, in Lancaster House, an ornate government building in London, is a significant reset for the two allies.

But the final details of several important policies were not in place, and Britain had to make some concessions that could prove politically costly for Starmer.

The agreement is designed to help the two sides work more closely together after the Trump administration signaled it was reducing its commitment to European defense and imposed global tariffs.

It also underscores the Labour government’s ambition for a “reset” of ties with the 27-nation EU, almost nine years after Britons voted by a narrow margin to leave the bloc — a decision that has dented Britain’s economic growth.

“It’s time to look forward,” Starmer said, “to move on from the stale old debates and political fights to focus on delivering common-sense, practical solutions which get the best for the British people.”

That message was echoed by von der Leyen, the head of the bloc’s executive body, who said, “We are now turning the page and opening a new chapter.”

The immediate, hostile reaction from Starmer’s opponents, however, illustrated the political perils for almost any politician in revisiting Brexit, the most fraught and divisive issue in recent British politics.

While opinion polls suggest most Britons now believe that leaving the EU was a mistake, the idea of rapprochement remains anathema to a vocal minority of pro-Brexit lawmakers and voters.

Under the agreement, European countries will be encouraged to allow British people to use electronic gates in Europe when crossing borders, and traveling with pets will be easier, too. The sale of some British meat products in the EU — Britain’s biggest trading partner — will be possible again, and some border checks on animal and plant products will end.

But the most important part of the deal is a security partnership that will bolster defense cooperation between the partners. It will allow them to better pool resources and share technology and intelligence at a moment when a more aggressive Russia — and a more reluctant United States — has left Europe scrambling to defend itself better. The fresh agreement could also pave the way for British companies to fully participate in the EU’s new 150 billion-euro ($168 billion) loan program for defense procurement.

“It’s very important and significant that the U.K. is moving back toward the center of Europe when it comes to military and defense,” said Paul Dales, chief U.K. economist at Capital Economics.

The rest of the deal — which focuses on trade and movement across borders — he called “a much smaller nudge.”

One of the most delicate issues in the trade talks was an extension of the right of European trawlers to fish in British territorial waters, in exchange for reduced trade barriers for British food products entering the EU’s giant single economic zone.

After discussions that continued until almost the last minute, the two sides agreed they would allow European boats access to British fishing waters until June 30, 2038.

That was not the indefinite extension that some in Europe had sought, but it is a far longer window than the British had initially suggested. Though economically of little significance, fishing is a politically sensitive issue, and the agreement was quickly seized on by Britain’s right-wing, pro-Brexit tabloids, with one calling it a “surrender.”