FALMOUTH, England—For British Prime Minister Boris Johnson, the Group of Seven summit that he hosted over the weekend was a major opportunity to showcase the U.K.’s ambitions on the global stage, putting its years inside the European Union decisively behind it.

But he couldn’t entirely make that happen. Wrangling over Brexit bled into the meeting, coloring what appeared to be a broadly successful summit.

The U.K. left the bloc last year following the 2016 Brexit referendum, and at the start of this year departed the bloc’s customs union and single market. That put into effect a convoluted deal to manage trade and preserve peace in Northern Ireland after Brexit that has since been the subject of a tense dispute between Mr. Johnson’s government and the EU.

The so-called Irish protocol avoided a border on the island of Ireland by creating in effect an economic border in the Irish Sea with customs and regulatory checks being carried out on goods sent to Northern Ireland from the rest of the U.K. and with tariffs being levied on some products.

Mr. Johnson says the implementation of the deal threatens the territorial integrity of the U.K.; the EU, including Ireland, says Mr. Johnson signed the deal, so he should carry out what he agreed to.

On Saturday, the leaders of Germany, France and the EU all met with Mr. Johnson and brought up the issue in bilateral meetings. President Biden made preserving peace on the island of Ireland a key part of a joint statement he issued with Mr. Johnson late last week. While officials said the matter was hardly discussed in the roundtables, the British leaders and others were repeatedly asked questions about the standoff.

“We will do whatever it takes to protect the territorial integrity of the U.K.,” Mr. Johnson said. He looked to play down the disagreement, saying that it had been a “vanishingly small part of our deliberations” during the G-7 meeting.

Italian Prime Minister Mario Draghi, one of the five leaders from the EU at the summit, said “This is about the integrity of the U.K., but deals have to be respected.”

The spat shows how Brexit risks overshadowing Britain’s efforts on the world stage. While the G-7 proved to be a largely friendly affair, at times Mr. Johnson cut an isolated figure. President Biden, while reaffirming the special relationship with Britain, made a show of striking up a close partnership with French President Emmanuel Macron and described the EU as “incredibly strong and vibrant.”

The Northern Ireland deal in effect puts Northern Ireland, unlike the rest of the U.K., inside the EU’s customs area and its single market, its zone of harmonized regulation. This unusual arrangement requires, according to the agreement, checks in the Irish Sea to keep track of what products are entering the EU.

Queen Elizabeth II welcomed President Biden and first lady Jill Biden to Windsor Castle on Sunday, following the G-7 summit.

Queen Elizabeth II welcomed President Biden and first lady Jill Biden to Windsor Castle on Sunday, following the G-7 summit.

Photo: Chris Jackson/Zuma Press

The diplomatic spat is coming to a head over sausages. The EU permits the importation of only frozen processed meat from outside its single market. Currently, the sale of raw sausage meat and chicken nuggets from Britain into Northern Ireland is permitted as the Brexit deal is phased in. Later this month, that grace period expires and the unfrozen British sausage may no longer travel across the Irish Sea.

Mr. Johnson has hinted that his government might unilaterally extend the grace period to allow the free movement of meat to continue. The EU says the U.K. must abide by the rules and has threatened tariffs if it doesn’t. Talks are still under way to find a solution. The EU has suggested that Britain should align its food-safety rules with the EU’s to remove the meat restrictions. Britain says it doesn’t want to be beholden to EU rules.

U.S. diplomats brought up the Irish issue with their British counterparts before the G-7, officials said. Fearing a broadside from EU members of the G-7, Mr. Johnson brought his Brexit secretary, David Frost, to the event.

Officials said that the Northern Ireland issue was discussed during the meeting of European Commission President Ursula von der Leyen with Mr. Johnson but that neither side believed the G-7 was the right place to address these concerns.

During a bilateral meeting with Mr. Macron, Mr. Johnson pointed out the French president would find it unacceptable if courts blocked the movement of sausages made in Toulouse, in southwestern France, to other parts of his country, officials said.

Mr. Macron said that the Toulouse sausage comparison wasn’t relevant and that they should focus on G-7 matters, according to a French official.

At the end of the summit, Mr. Macron bemoaned the dispute’s continuing to play out and said that the U.K. should stick by its commitments. “No one has made other countries spend so much time on their sovereignty,” he said.

Write to Max Colchester at max.colchester@wsj.com