The cease-fire is scheduled to begin at midnight on Saturday, but the 13-point compact appeared fragile, with crucial issues like the truce line left unresolved. Over all, there seemed to be no guarantee that the problems that marred the cease-fire agreement reached here in September had been ironed out.
The very fact that it took more than 16 hours of intensive negotiations to reach an agreement, and that the leaders announced the accord in three separate news conferences, seemed to highlight a certain lack of unity.
But after so many hours spent in the grandiose Independence Palace in Minsk, the Belarussian capital, all four leaders seemed determined to accent the idea that the agreement should be given the chance to quiet the yearlong conflict in eastern Ukraine.
"It consisted of a long night and a long morning, but we arrived at an accord on the cease-fire and the global end to the conflict," Francois Hollande, the French president, said at a news conference in a joint appearance with the German chancellor, Angela Merkel.
Ms. Merkel, who unexpectedly began a mediation effort with her French counterpart last week, said, "What we have on the table today gives us great hope." However, she simultaneously emphasized that there was much work ahead.
"We have no illusions," she said, "A great, great deal of work still needs to be done. But there is a real chance to turn things around toward the better."
President Vladimir V. Putin of Russia and President Petro O. Poroshenko of Ukraine, in their separate briefings, highlighted those parts of the agreement that matched their demands, while noting crucial outstanding questions.
"Despite all the difficulties of the negotiating process, we managed to agree on the main things," Mr. Putin said. Those issues included the withdrawal of heavy weaponry, a promise for constitutional change, and "special status" for the breakaway regions of Donetsk and Luhansk, he said.
Mr. Poroshenko, for his part, emphasized the humanitarian issues, like the release of all prisoners, including Nadiya V Savchenko, a female helicopter navigator who was elected to the Ukrainian Parliament while facing trial in Moscow. All foreign troops, military equipment and mercenaries should be withdrawn from Ukrainian territory, he said.
But the plan also included some tripwires, not least the questions about the truce line and the fate of the village of Debaltseve, an important railroad hub that has been the site of fierce fighting in recent weeks.
The deal calls for heavy artillery to be withdrawn at least about 15 miles from each side, and the biggest missiles even farther. The withdrawal is scheduled to start two days after the cease-fire and to be completed within two weeks.
Mr. Putin said that Mr. Poroshenko refused to acknowledge that the separatist forces had surrounded up to 8,000 Ukrainian soldiers in Debaltseve, but the Russian leader said he hoped that consultations between military commanders would settle that matter.
The Russian leader warned that the situation there carried the potential for renewed fighting, but he called on both sides to stop the bloodshed.
Even as all sides endorsed the pending cease-fire, the fighting that has left more than 5,400 people dead since last spring continued.
Pro-Russian rebel forces mounted a counterattack on areas east of the coastal city of Mariupol, trying to retake some of the ground seized in recent days by the volunteer, right-wing Azov Battalion.
Residents of Mariupol, an industrial port on the Sea of Azov that is widely expected to be the next target of rebel attacks if the truce agreed to in Minsk does not hold, said they could hear heavy shelling throughout the morning.
City and military officials said the fighting had not hit civilian areas in Mariupol, but had been confined to small villages to the east.
Through the new accord, Mr. Poroshenko sought to reassert Ukrainian control over the border with Russia. Kiev said the border remained porous, despite attempts at international monitoring, allowing Moscow easily to supply the two breakaway regions with men, money and matériel.
Russia and the separatists deny that Moscow is contributing any direct military aid.
The focus of the conflict in eastern Ukraine has shifted to the industrial port city of Mariupol. Ukrainian military officials reported that national guard units have begun an offensive against the pro-Russian rebels, who have been massing their forces near the city. If the rebels take control of Mariupol, they could open a land route between Russia and Crimea, which would ensure Russian control of the Sea of Azov.
But Russia said such border control by Kiev should be a lower priority than other issues, including constitutional change and local elections, which the compact says should come by the end of 2015.
The Kremlin is seeking to establish autonomous republics with their own economic and foreign policies, while Ukraine has only talked about decentralization. The compact says that decentralization will be carried out, but the degree of autonomy was ambiguous.
"This was not simple; in fact, unacceptable conditions were offered," Mr. Poroshenko said, calling a new cease-fire the main achievement. "We did not agree to any ultimatums."
The nearly four-page compact was signed by representatives of the separatists, Russia, Ukraine and the Organization for Security and Cooperation in Europe - which monitored the last fruitless cease-fire effort - and mirrored the September accord.
Aside from the cease-fire, the agreement called for a dialogue between the two sides on holding elections, with the talks to start the day after heavy weapons are withdrawn.
It also said that the Ukrainian Parliament should define by law the territory of the areas to have self-rule and should pass an amnesty for the separatist leaders. Kiev should also establish the means to pay pensions and other social benefits that have been cut off, it said, including linking the banking system back to the national network.
The peace talks appeared on the verge of collapse even as they were drawing to a close. News conferences originally scheduled to announce an agreement were postponed, and the leaders went back to the bargaining table.
The return was accompanied by a flurry of Russian news agency reports that Mr. Poroshenko had declined at the last minute to accept the outlines of the deal relating to the independent status of the breakaway areas of Donetsk and Luhansk, as well as the cease-fire demarcation line.
When the leaders of the breakaway regions joined the talks in the morning, they also initially balked at signing the agreement, according to the official Russian news agency Tass.
Over all, there are questions about whether groups on both sides that have driven the confrontation will abandon fighting, particularly the separatists.
Russia is believed to be trying to create a frozen conflict that could be used to destabilize Ukraine any time it draws too close to the West.
"The practical, realistic expectation is a frozen conflict with no effective control by Kiev over those areas, but no formal responsibility of Russia," said Fyodor Lukyanov, the editor of the journal Russia in Global Affairs.
But the conflict has also reached a point where Russia would have to commit significant new resources for any advance, which helped clear the way for a settlement, Mr. Lukyanov said.
The separatists "cannot advance very much without direct Russian involvement, and Russia does not want to get directly involved," he said.
Much of the negotiations overnight were consumed by discussion over each of the points of the protocol agreed to in September, and a working plan on how each might be carried out.
But senior officials remained tight-lipped as they shuffled between negotiating sessions that swelled with advisers and then shrunk back to the leaders repeatedly during the talks.
"A lot," was all Foreign Minister Sergey V. Lavrov of Russia responded when asked what news the talks had produced.
Neil MacFarquhar, The New York Times