“Sometimes you have to lose a battle to win the war,” British Prime Minister David Cameron said at a news conference in Brussels on Friday. Cameron had failed to block Jean-Claude Juncker from becoming the next president of the European Commission, which is the European Union’s executive body. (Alain Jocard/AFP/Getty Images)

Britain’s last-ditch efforts to block Jean-Claude Juncker from becoming the next president of the European Commission failed spectacularly Friday as the ex-Luxembourg prime minister received resounding support in his nomination to the top job in Brussels, a move that could hasten Britain’s exit from the European Union.

It was a diplomatic dogfight British Prime Minister David Cameron was expected to lose, but still he went down swinging.

“Sometimes you have to lose a battle to win the war,” a defiant Cameron told a news conference in Brussels.

On Friday, 26 of 28 countries in the E.U. voted in favor of Juncker — only the United Kingdom and Hungary dissented — to become the next president of the European Commission, the E.U.’s executive body that proposes and enforces regulations that affect the lives of 500 million people.

Cameron said he would continue to work with “intensity and with grit” to reform the scale, size and scope of the E.U., but conceded that the task of keeping Britain in the bloc was now harder.

Cameron publicly opposed Juncker, as well as the process by which he ascended to the role.

He believes that Juncker, a 59-year-old dealmaker and fixture in corridors around Brussels, is an arch-federalist who will thwart his efforts to reform the E.U., which he needs to do if he is to follow through on his pledge of an in-out referendum in 2017.

He also opposed the new way that the European Parliament — not the elected heads of national governments — effectively put forward its preference for the leading candidate.

German Chancellor Angela Merkel, meanwhile, appeared to extend an olive branch to Cameron, telling a news conference that the U.K.’s concerns “will be addressed.”

Although she is at odds with him over Juncker — whom she backs — Merkel is nevertheless eager to ensure that Britain remains part of the union.

Despite London’s constant railings against the bureaucrats in Brussels, Merkel and Cameron generally concur on the need for — if not the specifics of — future E.U. reforms. Cameron and Merkel also are fiscal conservatives at a time when a socialist government reigns in France.

In short, she is still better off with him than without him.

But across Europe, he is being seen through increasingly skeptical eyes.

“Merkel understands she really needs the U.K. in the E.U., so she will try to be positive with him where she can,” said Stefan Meister, senior policy fellow in the Berlin office of the European Council on Foreign Relations. “The problem is, Cameron is very destructive. He just wants to stop things, reduce things in the E.U. And he doesn’t want Juncker. It’s a negative, destructive agenda.”

The stakes were always high for Cameron, who faces electoral pressure from Britain’s U.K. Independence Party, which is against the E.U., as well as back-benchers in his own party who are calling for a curb on immigration.

But critics of Cameron’s, even those who roll their eyes at Juncker, have roundly questioned his tactics, timing and tone in launching such a public campaign against Juncker, the man who has long been the front-runner for the job.

Ed Miliband, leader of the opposition Labor Party in the U.K., said Cameron should be blamed for a “failure to build the alliances we need in Europe.”

Juncker is expected to be approved as president in a vote by the European Parliament on July 16.

Anthony Faiola reported from Berlin.