President Obama and Russian President Vladi­mir Putin failed to reach a deal Monday on a cease-fire for Syria, but the two sides have agreed to continue negotiating even as Syrian government forces close in on the beseiged city of Aleppo.

Meeting with Putin on the sidelines of the Group of 20 economic meeting here, Obama emphasized the humanitarian importance of and urgent need for a cease-fire, but he was adamant about not striking an agreement that wouldn’t meet his long-term objectives in Syria, said a White House official who spoke on the condition of anonymity under ground rules.

The 90-minute unscheduled meeting was described by both sides as longer than usual for the sidelines of a G-20 summit. But an ultimate agreement remained elusive.

At a news conference, Obama said the breakdown of a previous cessation of hostilities agreement had prompted Syrian President Bashar al-Assad to resume bombing opposition forces “with impunity.” That has led opposition forces, including those with ties to terrorism, to ramp up recruitment of new fighters, the president said.

“That is a very dangerous dynamic,” Obama said. Of his meeting with Putin, he added: “We have had some productive conversations about what a real cessation of hostilities would look like to allow us to both focus our energies on common enemies. . . . But given the gaps of trust that exist, that’s a tough negotiation. We haven’t yet closed the gap.”

In Aleppo, Syrian government forces and their allies laid siege to rebel held areas in the east of the city. The offensive relied heavily on Russian airpower and reversed key gains by the rebels in early August. (Reuters)

Obama said he and Putin also discussed the security situation in Ukraine and disputes over ­cyberespionage. The president declined to directly answer a reporter’s questions about Russia’s alleged hacking of the Democratic National Committee’s emails, citing an ongoing investigation, but he acknowledged tensions.

“We’ve had problems of cyber intrusions from Russia and other countries in the past,” Obama said, “and we’re moving into a new era here where a number of countries have significant capacities. We have more capacity than anybody both offensively and defensively. Our goal is not to suddenly, in the cyber arena, duplicate the cycle of escalation we saw when it comes to other arms races in the past, but rather implementing some norms so everyone is acting responsibly.”

The White House official, briefing reporters in Hangzhou, said that Secretary of State John F. Kerry and Russian Foreign Minister Sergei Lavrov “are making plans to meet in the coming days, certainly this week. If an agreement can be reached, we want to do so urgently because of the humanitarian situation. However, we must ensure it is an effective agreement.”

The official, speaking on condition of anonymity, said the United States has been focused on making sure that the agreement allows for a “period of calm so that we can get urgently needed humanitarian assistance to populations that are in need.”

The official admitted, however, that there were still “significant differences” with the Russians.

“It’s clear now what our respective positions are, and we’ll see in coming days whether on Syria we can reach a near-term agreement,” he added. “If we cannot get the type of agreement we want, we will walk away from that effort.”

The collapse of a deal comes as a major new Syrian-Russian offensive in the besieged city of Aleppo appeared to undermine key components of the proposed agreement.

On Sunday, after an anticipated news conference did not take place, Kerry told reporters that his negotiations here with Lavrov snagged on “a couple of tough issues” — nearly identical to the language he used when the two failed to reach agreement in their last meeting, just over a week ago in Geneva.

The administration, which has long been reluctant to intervene directly in the civil war, nonetheless thinks that it is a distraction to what it considers the more important, separate battle against the Islamic State — in both Syria and Iraq — and that it must be resolved.

Kerry, with approval from Obama, traveled to Moscow in mid-July to propose an agreement under which the United States would share intelligence and coordinate its bombing of terrorist targets with Russia if Moscow would agree to ground the Syrian air force and stop its own bombing of U.S.-backed ­opposition forces.

Russia has complained of increasing overlap between the opposition and terrorist groups on the ground, and it said it was up to the United States to separate them before a deal could be struck. U.S. failure to do so has allowed the Russians to claim they are targeting only terrorists of the Front for the Conquest of Syria — or Jabhat Fatah al-Sham, the al-Qaeda affiliate formerly known as Jabhat al-Nusra — and the Islamic State.

In comments to Russian journalists earlier in the day, Deputy Foreign Minister Sergei Ryabkov indicated that the separation of forces remains an issue.

For months, he said, Russia has been asking the Americans for “a real, genuine demarcation between terrorists and the so-called opposition.”

On Aug. 26, Kerry met with Lavrov in Geneva to try to build momentum for the proposal. The two sides said then that they were “close” to agreement and that military and intelligence teams from both sides were ironing out “technical details.” Kerry predicted a deal could be reached within a week.

The White House official said there has been some “backsliding” since the discussions between Kerry and Lavrov last month in Geneva.

The United Nations says that in the city of Aleppo — divided between rebels in the east and the government in the west — nearly 2 million people are without food, water and medical care. The northern route out of the city to Turkey, previously held by the rebels, has been cut by the government.

The Syrian government over the weekend made important battlefield gains around Aleppo that challenge basic assumptions of a proposed cease-fire that was to freeze last week’s battle lines.

While Front-led forces last month broke through government encirclement from the south to join with opposition rebels occupying the eastern half of the city, that route now also appears to be closed as a conduit for aid, as the government launched a major push to retake it. Late on Sunday, Syrian forces, backed by Russian airstrikes, seized control of the area, known as the Ramouseh corridor, and fully laid siege to Aleppo.

Russian support for the offensive prompted U.S. officials to raise questions about whether the Russians could be relied upon to implement an agreement to freeze battle lines and ground the Syrian air force.

Beyond Aleppo, Russia and the Assad government have continued to refuse to allow U.N. humanitarian aid convoys to enter more than a dozen besieged towns and cities held by various rebel forces.

Meanwhile on Monday, a string of explosions across Syria, most of them targeting government checkpoints, killed at least 40 people. The deadliest attack was a twin bombing on the loyalist province of Tartus, according to the official Syrian Arab News Agency. A car bomb exploded on a bridge, and then a suicide bomber struck when people gathered to take the wounded to a hospital, SANA said. At least 30 people were reported killed.

Elsewhere, four people died in an explosion at a checkpoint in the city of Homs, and one person died in a bombing in the countryside surrounding Damascus, the capital. Five people died in a motorcycle bombing in the northeastern city of Hasakah.

The Islamic State militant group asserted responsibility for the bombings, as well as for another that targeted Syrian Kurds in the northeastern city of Qamishli and was not reported by SANA.

Liz Sly in Beirut and Karen DeYoung in Washington contributed to this report.

Read more:

U.S., Russia say they are close to cooperation deal in Syrian war

Kerry pushes for coordination with Russia as others in administration cry foul

Obama’s China visit gets off to rocky start, reflecting current relations

Today’s coverage from Post correspondents around the world