BRUSSELS -As Britain has danced on the edge of a European Union exit, continental leaders have repeatedly insisted they want their island neighbour to remain a part of the club.
Now those leaders will have to decide how far they are willing to go to persuade the UK to stay.
Months of negotiations over British demands to reconfigure its relationship with the EU are expected to culminate in a deal at an EU summit here this week. British Prime Minister David Cameron has said the outcome of the talks will be critical to persuading his citizens to opt for "in" when the UK holds its referendum on membership in the 28-member bloc.
But as late as Wednesday night, Cameron was struggling to win concessions from European counterparts who have been reluctant to grant the British premiere the sort of wide-ranging changes he craves.
The tough bargaining by continental leaders reflects the limits of their tolerance toward British demands that have struck some as petty, divisive and distracting at a time when Europe is facing a panoply of existential threats. European leaders want to prevent Britain from bolting. But not at any cost.
"Europe has basically said, 'We're trying to help you because we want to keep you in. But at some point, there's a limit to what you can ask for,' " said Karel Lannoo, chief executive of the Brussels-based Center for European Policy Studies. "Ultimately, the British need to make a decision: Are they part of Europe or not?"
The question could be settled as soon as June, assuming Cameron and the other 27 EU leaders are able to strike a deal this week. The British prime minister has promised the referendum by the end of 2017, following years of demands from Euroskeptics in his own Conservative Party. But experts say the vote will come far sooner because delay only increases the chances of a vote for "out." Polling indicates a contest that could go either way.
A British departure would mark the first time an EU member has chosen to leave the club that has defined European politics and economics for decades, and that is credited by backers with helping to keep the peace on a continent scarred by a long history of especially destructive wars.
Related reading:
Cameron hopes for EU reform at summit
Experts fear that the country's exit - popularly known as Brexit - could trigger a broader unraveling of the EU at a time when the continent is already grappling with a refugee crisis, renewed Russian aggression, terrorist attacks and a surging far-right.
Along with Germany and France, Britain is regarded as one of the three essential members of the union. But it has long been an ambivalent participant, signing up for the benefits of the single market while opting out of the common currency and Europe's borderless travel zone.
Cameron's negotiation is aimed at even further loosening the ties between the UK and a Brussels-based bureaucracy that Brexit proponents regard as a stifling infringement on national sovereignty.
His four demands consist of: an opt-out from the EU's founding ambition to forge "ever closer union"; greater power for national parliaments to block EU legislation; formal recognition that the euro isn't the union's only currency and permission to restrict benefits for immigrants from within the EU.
But draft proposals for a deal have proved underwhelming, and have been widely mocked by advocates for "out." Without a more robust package of overhauls, the prime minister risks losing the support of key Conservative allies, including London Mayor Boris Johnson, who has played coy on his EU stance.
Cameron on Wednesday night was reported to be pushing for last-minute concessions that would allow him to declare victory before he officially launches the referendum campaign, a move expected when he returns home on Friday.
The prime minister may have an ally in that cause in German Chancellor Angela Merkel. She told her parliament Wednesday that British demands for EU restructuring were "justified and necessary."
Keeping the UK in the EU, she said, was "not just in Britain's but also in Germany's interest, and that of Europe as a whole."
But several Eastern European countries have signalled they will fight plans to allow London to restrict social-welfare benefits for European immigrants working in Britain.
Record immigration to the UK - much of it fuelled by Eastern Europeans seeking better job opportunities - has been one of the main drivers of anti-EU sentiment in Britain. That makes the benefit restriction especially critical to Cameron's plans, and leaves him politically exposed if Eastern European countries succeed in watering down the provision.
Even as they seek protections for their workers who have immigrated to Britain, Eastern European governments are also blocking attempts to forge a united response to the continent's refugee crisis. The issue will be on the agenda when European leaders meet on Thursday, but few tangible results are expected.
The impasse could ultimately aid the pro-Brexit campaign, which has argued that Britain needs to further distance itself from the chaotic migrant flows on the continent.
"The refugee crisis has made it much harder for the 'in' crowd to make their case because it makes the EU look even worse," said Jan Techau, director of Carnegie Europe.
Ironically, Britain is already largely insulated from the refugee crisis; it has a special exemption from the EU-wide quota for refugees, and the 19 miles (30km) of water between the British and French coasts make it extremely difficult for migrants to reach British shores.
It is that kind of special status that often prompts head-shaking on the continent over why Britain would threaten to leave.
"They're half-in, half-out," said Pierre Vimont, who is also with Carnegie Europe. "It's the best they could ever get."