People demonstrate in Parliament Square against the possible Conservative and DUP coalition government following the Britain's general election result, in London, Saturday June 10, 2017. Prime Minister Theresa May's gamble in calling an early election backfired spectacularly as her Conservative Party lost its majority in Parliament. (AP Photo/Tim Ireland)

People demonstrate in Parliament Square against the possible Conservative and DUP coalition government following the Britain's general election result, in London, Saturday June 10, 2017. Prime Minister Theresa May's gamble in calling an early election backfired spectacularly as her Conservative Party lost its majority in Parliament. (AP Photo/Tim Ireland)

LONDON (AP) — British Prime Minister Theresa May struck a deal in principle with Northern Ireland’s Democratic Unionist Party on Saturday to prop up the Conservative government, stripped of its majority in a disastrous election.

The result has demolished May’s political authority, and she has also lost her two top aides, sacrificed in a bid to save their leader from being toppled by a furious Conservative Party.

The moves buy May a temporary reprieve. But the ballot-box humiliation has seriously — and possibly mortally — wounded her leadership just as Britain is about to begin complex exit talks with the European Union.

ADVERTISEMENT

May’s office said Saturday that the Democratic Unionist Party, which has 10 seats in Parliament, had agreed to a “confidence and supply” arrangement with the government. That means the DUP will back the government on key votes, but it’s not a coalition government or a broader pact.

Downing St. said the Cabinet will discuss the agreement on Monday.

The announcement came after May lost Downing St. chiefs of staff Nick Timothy and Fiona Hill, who resigned Saturday. They formed part of May’s small inner circle and were blamed by many Conservatives for the party’s lackluster campaign and unpopular election platform, which alienated older voters with its plan to take away a winter fuel allowance and make them pay more for long-term care.

In a resignation statement on the Conservative Home website, Timothy conceded that the campaign had failed to communicate “Theresa’s positive plan for the future,” and missed signs of surging support for the opposition Labour Party.

Some senior Tories had made the removal of Hill and Timothy a condition for continuing to support May, who has vowed to remain prime minister. May’s party won 318 seats, 12 fewer than it had before May called a snap election, and eight short of the 326 needed for an outright majority. The main opposition Labour Party surpassed expectations by winning 262.

May announced later that Gavin Barwell — a former housing minister who lost his seat in Thursday’s election — would be her new chief of staff.

May said Barwell would help her “reflect on the election and why it did not deliver the result I hoped for.”

Conservative legislator Nigel Evans said the departure of the two aides was “a start,” but there needed to be changes to the way the government functioned in the wake of the campaign.

ADVERTISEMENT

He said the Conservative election manifesto — which Hill and Timothy were key in drafting — was “a full assault on the core Tory voters, who are senior citizens.”

“It was a disaster,” he said. “Our manifesto was full of fear and the Labour Party’s manifesto was full of promises.”

Martin Selmayr, senior aide to European Commission President Jean-Claude Juncker, responded to the resignations by tweeting the word “bauernopfer” — German for the sacrifice of a pawn in chess.

May called the early election when her party was comfortably ahead in the polls, in the hope of increasing her majority and strengthening Britain’s hand in exit talks with the EU.

Instead, the result has sown confusion and division in British ranks, just days before negotiations are due to start on June 19.

May wanted to win explicit backing for her stance on Brexit, which involves leaving the EU’s single market and imposing restrictions on immigration while trying to negotiate free trade deal with the bloc. Some say her failure means the government must now take a more flexible approach to the divorce.

The Times of London said in an editorial that “the election appears to have been, among other things, a rejection of the vague but harshly worded prospectus for Brexit for which Mrs. May sought a mandate.”

It added that “the logic leading to Mrs. May’s departure from Downing St. is remorseless.”

The Downing St. resignations came as May worked to fill jobs in her minority government and replace ministers who lost their seats on Thursday. Her weakened position in the party rules out big changes, and May’s office has said that the most senior Cabinet members — including Treasury chief Philip Hammond, Foreign Secretary Boris Johnson and Home Secretary Amber Rudd — will keep their jobs, but she is expected to shuffle the lower ranks of ministers.

The arrangement with the DUP will make governing easier, but it makes some Conservatives uneasy. The DUP is a socially conservative pro-British Protestant group that opposes abortion and same-sex marriage and once appointed an environment minister who believes human-driven climate change is a myth.

The DUP was founded in the 1970s by the late firebrand preacher Ian Paisley, and in the 1980s was a key player in the “Save Ulster from Sodomy” campaign, which unsuccessfully fought against the legalization of gay sex.

Ruth Davidson, the Conservative leader in Scotland, said she had asked May for assurances that there would be no attack on gay rights after a deal with the DUP.

Northern Ireland is the only part of the U.K. in which same-sex marriage is illegal.

“It’s an issue very close to my heart and one that I wanted categoric assurances from the prime minister on, and I received (them),” said Davidson, who is engaged to be married to her female partner.

DUP Leader Arlene Foster recently denied the party was homophobic.

“I could not care less what people get up to in terms of their sexuality. That’s not a matter for me,” she said. “When it becomes a matter for me is when people try to redefine marriage.”

A deal between the government and the DUP could also unsettle the precarious balance between Northern Ireland’s British loyalist and Irish nationalist parties.

Labour leader Jeremy Corbyn, riding a wave of acclaim for his party’s unexpectedly strong showing, called on May to resign.

Newspaper headlines saw her as just clinging on. “May fights to remain PM,” said the front page of the Daily Telegraph, while the Times of London said: “May stares into the abyss.”

But she seems secure for the immediate future, because senior Conservatives don’t want to plunge the party into a damaging leadership contest.

“I don’t think throwing us into a leadership battle at this moment in time, when we are about to launch into these difficult negotiations, would be in the best interests of the country,” Evans said.