The United States and Russia announced early Saturday a breakthrough agreement on Syria that foresees a nationwide ceasefire starting early next week, followed by an unlikely new military partnership between the rival governments targeting ISIS and al-Qaeda.

U.S. Secretary of State John Kerry said the plan could reduce violence in Syria and lead to a long-sought political transition, ending more than five years of bloodshed. He called the deal a potential "turning point" in a conflict that has killed as many as 500,000 people, if complied with by Syria's Russian-backed government and U.S.-supported rebel groups.

The ceasefire begins at sundown Monday, Kerry said, coinciding with the Muslim Eid al-Adha holiday.​

Kerry's negotiating partner, Russian Foreign Minister Sergey Lavrov, confirmed the agreement and said it could help expand the counterterrorism fight and aid deliveries to Syrian civilians. He said Syrian President Bashar al-Assad's government was prepared to comply.

Counterterrorism alliance

The deal culminates months of frenetic diplomacy that included four meetings between Kerry and Lavrov since Aug. 26. The arrangement hinges on Moscow pressuring Assad's government to halt all offensive operations against Syria's armed opposition and civilian areas. Washington must persuade "moderate" rebels to break ranks with the Nusra Front, al-Qaeda's Syria affiliate, and other extremist groups.

Both sides have failed to deliver their ends of the bargain over several previous truces.

But the new arrangement goes further by promising a new U.S.-Russian counterterrorism alliance, only a year after U.S. President Barack Obama chastised Russia for a military intervention that U.S. officials said was mainly designed to keep Assad in power and target more moderate anti-Assad forces.

The deal includes intelligence sharing and targeting co-ordination, a level of U.S.-Russian interaction that has upset several leading national security officials in Washington, including Defence Secretary Ash Carter and National Intelligence Director James Clapper. The joint military work would only begin after several days of adherence to the new ceasefire.

The UN special envoy for Syria said he welcomed the agreement.

"The United Nations hopes that the political will that led to this understanding is sustained. It creates a real window of opportunity which all relevant actors in the region and beyond should seize to put the crisis in Syria on a different path and ease the violence and suffering being endured by the Syrian people," Staffan de Mistura said.

He called on both countries to facilitate UN efforts to deliver humanitarian aid to Syrians in hard-to-reach and besieged areas.

"It is vital that real change is felt on the ground by the Syrian people."

Pizza and vodka

At one point, Lavrov said he was considering "calling it a day" on talks, expressing frustration with what he described as an hours-long wait for a U.S. response. He then presented journalists with several boxes of pizza, saying, "This is from the U.S. delegation," and two bottles of vodka, adding, "This is from the Russian delegation."

Alexander Zorin, from the Russian delegation, carries pizzas 'from the U.S delegation' to reporters awaiting a late-night press conference in Geneva. (Kevin Lamarque/Reuters)

Russian Foreign Minister Sergey Lavrov delivers vodka to reporters, saying, 'This is from the Russian delegation.' (Kevin Lamarque/Reuters)

The Geneva negotiating session, which lasted more than 13 hours, underscored the complexity of a conflict that includes myriad militant groups, shifting alliances and the rival interests of the U.S. and Russia, Saudi Arabia and Iran, and Turkey and the Kurds.

Getting Assad's government and rebel groups to comply with the deal may now be more difficult as fighting rages around the divided city of Aleppo, Syria's most populous and the new focus of a war that has killed as many as 500,000 people.​

Assad's government appeared to tighten its siege of the former Syrian commercial hub in the last several days, seizing several key transit points.

Volunteers assist an injured man after an airstrike in the rebel held Douma neighbourhood of Damascus, Syria, Sept. 9. Tens of thousands have died in Syria's five-year civil war. (Bassam Khabieh/Reuters)

Syrian children living in the refugee camp of Delhemiyeh village in eastern Lebanon celebrate Eid al-Fitr on July 6. Syria's civil war has chased millions from their homes, creating a global refugee crisis. ( Jamal Saidi/Reuters)

Forty days of fighting in Aleppo has killed nearly 700 civilians, including 160 children, according to a Syrian human rights group. Volunteer first responders said they pulled the bodies of nine people, including four children, from rubble following air raids Friday on a rebel-held area.

In addition to killing hundreds of thousands, Syria's conflict has chased millions of people from their homes, contributing to Europe's worst refugee crisis since the Second World War. Amid the chaos of fighting between Syria's government and rebels, ISIS has emerged as a global terror threat.