Afghanistan's President Ashraf Ghani and his rival Abdullah Abdullah signed a power-sharing agreement, ending months of political uncertainty.
Ghani will remain president, while the two men will choose an equal number of ministers.
Dr. Abdullah will lead peace talks with the Taliban, should they start.
The agreement in the capital Kabul is expected to help maintain the balance of power that existed before last year's disputed presidential elections.
Ghani and Abdullah – who claimed victory in last September's elections – held rival inauguration ceremonies last month.
The Afghan election commission says Ashraf Ghani narrowly won the vote, but Abdullah claimed that the result is fraudulent.
The deal comes days after a militant attack on a maternity hospital in the capital, Kabul, left 24 people dead. Mothers, newborn babies and nurses were among the victims.
No group admitted to carrying out the attack that shocked Afghanistan and the world.
And the power-sharing agreement?
Ghani and Abdullah – former rivals who held positions in the previous government – signed the deal on Sunday.
Abdullah, a former eye surgeon, wrote on Twitter after the ceremony that the agreement would help to form a "more inclusive, accountable and competent administration".
"Now we need to come together as a nation, to strive for practical solutions."
President Ghani Sediq Sediqqi's spokesman said details of the positions held by Dr. Abdullah's team members will be revealed later.
The deal comes as Afghan authorities hope to enter peace talks with the Taliban to end years of violence.
Last month, the Taliban came out of negotiations, saying that any face-to-face discussions with the Afghan government proved "fruitless".
The negotiations would have failed due to a previously agreed prisoner exchange between the United States and the Taliban.
It was supposed to be a step towards ending the war, but the Taliban say the Afghan authorities are trying to delay the release, while the authorities say the militants' demands are irrational.
Afghans, still suffering from last week's unthinkable attack on mothers and mourners, will receive any ray of light in the surrounding darkness.
Some hope that this much-disputed deal will be stronger than the 2014 deal, which was won by decisive U.S. external mediation, but later collapsed.
But this power-sharing pact involves the same individuals and interests, the same personal and political confrontations. And the same leaders and warlords of the past are still sitting in the front row of a tortuous story.
However, several crises are converging now: accelerating violence, a deadly virus and hunger.
Afghans will seek their leaders to prioritize a country's desire for peace before their own political futures.
Moving towards negotiations with the Taliban is a process full of growing doubts and dangers.
This agreement provides a political framework for building a way out of the war. He needs to stand firm so that he doesn't fall into the many obstacles that will come.
You might also be interested in: