The rival Palestinian factions Fatah and Hamas announced Monday they had agreed that Palestinian Authority President Mahmoud Abbas will head an interim unity government that will prepare for new elections, ending a prolonged stalemate over how to mend their bitter rift.

The move drew a sharp response from Israeli Prime Minister Benjamin Netanyahu, who warned Abbas that his alliance with Hamas would doom peace efforts.

The deal announced Monday in Doha, Qatar, removes a major stumbling block to carrying out a reconciliation accord signed by the two Palestinian movements last year. The understanding, brokered by the emir of Qatar, Sheik Hamad Bin Khalifa al-Thani, was reached in talks he hosted between Abbas, who heads Fatah, and Khaled Meshal, the exiled political leader of Hamas.

In a statement, both sides said that Abbas would lead an interim government “of independent technocrats . . . whose task will be to facilitate presidential and parliamentary elections and begin the reconstruction of Gaza.”

Abbas promised “to implement this agreement as soon as possible,” and Meshal said “we are serious about healing the wounds . . . to reunite our people on the foundation of political partnership.”

Fatah and Hamas were deadlocked for months over who would be prime minister of the interim government. Hamas rejected Salam Fayyad, the Western-backed prime minister of the Palestinian Authority, because he had led a crackdown on Islamist group in the West Bank.

Having Abbas at the helm of the interim government, holding the title of prime minister as well as president, could help preserve Western support, including crucial financial aid, for the Palestinian Authority.

The European Union, one of the major financial backers of the Palestinian Authority, said it looked forward to continuing its support, provided the new government was committed to non-violence, recognized Israel and accepted previous agreements and a negotiated peace settlement with Israel.

Hamas, which for years carried out deadly suicide bombings and has fired rockets into Israel, rejects those conditions. Hamas is considered a terrorist group by Israel, the United States and the European Union and has been boycotted by much of the West.

A State Department spokeswoman said that U.S. officials had not had a chance to talk to Palestinian officials or review details of the deal. “We are not going to give a grade to this thing until we have a chance to talk to Palestinian Authority leaders about the implications,” spokeswoman Victoria Nuland said during the department’s regular daily news briefing.

Netanyahu warned Abbas that carrying out the pact with Hamas would mean that he will “join forces with the enemies of peace.”

“You can’t have it both ways,” Netanyahu said. “It’s either a pact with Hamas or peace with Israel.”

Peace efforts have been stalled for well over a year. Exploratory talks last month hosted by Jordan failed to produce progress toward renewed negotiations, and Abbas is considering whether to continue those meetings.

Under the terms of the Fatah-Hamas accord, the interim government, composed of professionals unaffiliated with either faction, is to prepare for elections in May, although after months of delay the timing of that vote remains uncertain. The government also is supposed to lead efforts to help rebuild areas of the Gaza Strip heavily damaged by an Israeli war against Hamas in 2008 and 2009.

Yasser Abed Rabbo, a senior aide to Abbas, said that the joint government would be “a technical government more than a political one” and that diplomatic affairs would “remain with the presidency and the Palestine Liberation Organization.”

Azzam al-Ahmad, a senior Fatah official, said he hoped the new government could be announced at a Feb. 18 meeting of Palestinian factions.

Hamas won the last Palestinian parliamentary elections in 2006, and it routed Fatah in a brief factional war in the Gaza Strip in June 2007, seizing control of the territory. Since then, Fatah has led the Palestinian Authority government in the West Bank, with each faction jailing activists, closing offices and banning demonstrations by its rival.

With Syria in turmoil, the exiled political leaders of Hamas, based for years in Damascus, have left the country as the movement seeks to realign itself in a shifting Middle East. Meshal, who has been staying in Qatar, visited Jordan last month with the Qatari crown prince, signaling a thaw in relations. Jordan had deported Meshal and banned Hamas in 1999.