An E.U. flag hangs beside the Union Jack at the Europa House in London on Wednesday. (Frank Augstein/AP)

British Prime Minister David Cameron was locked early Friday in intense talks with his fellow European Union leaders on a deal that could set the tone for what is expected to be a bruising campaign to decide whether the United Kingdom leaves the 28-member bloc.

Meeting in Brussels, the leaders negotiated late into Thursday night — and then well into Friday morning — as Cameron sought concessions that would help him make the case back home for his country’s continued membership.

By most accounts, the negotiations over Britain’s reform proposals proved trickier than expected, with European Council President Donald Tusk announcing just before 3 a.m. that there was “a lot still to be done.”

British and E.U. officials said substantial gaps needed to be bridged before the two sides could reach agreement. Plans to seal the deal over an English breakfast on Friday morning were pushed back at least to brunch, and some suggested the talks could drag into the weekend.

But even as the leaders haggled, analysts said the prime minister would need to settle for an agreement that falls well short of his original intention to fundamentally renegotiate Britain’s ­relationship with the E.U.

“What he will get is not revolutionary,” said Janis Emmanouilidis, director of studies at the ­Brussels-based European Policy Center. “This won’t change Europe.”

A British exit, however, very much would.

[Europe wants Britain to stay in the E.U., but not at any cost]

The country has long been an ambivalent E.U. member, but it remains one of the bloc’s cornerstones. If the country votes to leave in a referendum expected in June, it could trigger a broader European unraveling at a time when continental unity is being strained by a refugee crisis, renewed Russian aggression, terrorist attacks and rising nationalism.

If Britain voted to leave, Emmanouilidis said, it would probably embolden “anti-E.U. voices in other member states saying there is a way out.”

European leaders appeared mindful of that risk as they gathered Thursday, suggesting they intended to give Cameron enough of what he wants to enable him to declare victory by the time the summit ends Friday.

“I’m going into this debate with the position that we would like to do everything to create the conditions so that Great Britain can remain part of the European Union,” German Chancellor Angela Merkel said as she arrived for the talks.

But European leaders have already taken a tough line, denying Cameron the sort of far-reaching change he sought. The prime minister has long said he favored Britain’s continued E.U. membership only if he could win substantial reforms.

Eastern European leaders were particularly unbending as the prime minister pushed for welfare caps that could help to reduce net migration to Britain.

Cameron is expected to win the right to apply “an emergency brake” to benefits for new arrivals from within the E.U. But the details remained hotly contested. It was unclear how effective the measure will be in limiting immigration to Britain, much of which comes from the poorer countries in Europe’s east.

Cameron has also sought protections for members of the E.U. that don’t use the euro, an exemption from the bloc’s pledge of ­“ever-closer union” and a national veto over E.U. legislation.

[Has Prince William entered Britain’s debate over leaving Europe?]

Draft versions of the deal, circulated in recent days, have been ridiculed by Cameron’s critics, “out” campaigners and Britain’s influential tabloids. All have excoriated the prime minister for not achieving more.

Tim Montgomerie, a blogger and activist, used his Times of London column Thursday to announce he was quitting the Conservative Party because of his disillusion with Cameron.

“This charade over the EU is the final straw,” he wrote.

More defections could soon follow. Other prominent members of Cameron’s party have flirted with defying the prime minister and supporting a British exit — popularly known as “Brexit.” London Mayor Boris Johnson has been particularly coy, but he could become the effective leader of the “out” campaign if he chooses to back a British departure.

Polls suggest that the contest could go either way, although most show “in” at least slightly ahead. Assuming Cameron can strike a deal in Brussels, he is expected to return to London on Friday to officially launch the campaign and to set a date for the vote — widely tipped as June 23.

Britain’s membership was not the only hot-button item on the agenda Thursday: Over a marathon five-hour dinner, Europe’s top officials engaged in occasionally heated discussion of how to handle the flood of refugees landing on Greek and Italian shores.

A new Austrian plan to begin sharply limiting the number of asylum seekers who can enter the country each day sparked particularly intense debate, officials said. The country's chancellor, Werner Faymann, later said the limits would still be implemented as planned, beginning on Friday.

With the flows into Europe continuing unabated, the E.U.’s leaders made plans to meet again in early March along with top Turkish officials. The E.U. last year struck a deal for Turkey to crack down on people-smuggling in exchange for billions of euros in aid.

Merkel said early Friday that Austria’s move had made it “more urgent” for Europe to assess whether the deal with Turkey is working.

Karla Adam in London contributed to this report.

Read more

Spring could bring a fresh surge of refugees. But Europe isn’t ready for them.

In supposed no-go zone, British Muslims, Christians say no to fanatics

Even Europe’s humanitarian superpower is turning its back on refugees

Today's coverage from Post correspondents around the world