Barack Obama delivered a grave warning on Friday about the danger of post-Assad Syria becoming a haven for Islamist extremists.

He portrayed a nightmare scenario in which Syrian institutions were destroyed beyond recognition and the country divided by sectarianism, with jihadists filling the gap.

"Something has been broken in Syria, and it's not going to be put back together perfectly immediately, even after Assad leaves," Obama said. "But we can begin the process of moving it in a better direction, and having a cohesive opposition is critical to that."

He was speaking at a joint press conference with King Abdullah II of Jordan, on the last leg of his Middle East tour.

Obama is resisting pressure from some in Congress as well as the new secretary of state John Kerry to become more involved in Syria. A handful of Republican and Democratic senators are urging him to impose a no-fly zone to keep president Bashar al-Assad's air force grounded, while Kerry is advocating arming Syrian rebels.

Having presided over the withdrawal of US forces in Iraq and with American forces due to leave Afghanistan next year, Obama is reluctant to become embroiled in another war. In Libya, he let France and Britain take the lead.

But the prospect of Islamist jihadists being able to operate freely in Syria is worrying, he said.

"I am very concerned about Syria becoming an enclave for extremism because extremists thrive in chaos," Obama said. "They don't have much to offer when it comes to actually building things, but they're very good about exploiting situations that are no longer functioning. They fill that gap."

In the run-up to Obama's trip, foreign policy analysts in Washington warned about Syria turning into a failed state, with one saying that about half the country's economy had collapsed since fighting began. If Syria became a power vacuum in which jihadists could operate freely, this could pose a threat not only to Israel but to neighbouring countries such as Jordan and Lebanon.

Asked why the US is not more involved, Obama said: "I think it's fair to say that the United States often finds itself in a situation where if it goes in militarily, then it's criticised for going in militarily, and if it doesn't go in militarily, then people say, why aren't you doing something militarily?"

Obama said there was no longer any doubt that Assad would go. "It's not a question of if, it's when," he said.

He urged the international community to help build a credible alternative to Assad by bolstering the opposition. "We can't do it alone, and the outcome in Syria is not going to be ideal. Even if we execute our assistance and our coordination and our planning and our support flawlessly, the situation in Syria now is going to be difficult," he said.

"We haven't just led with words, but we've also led with deeds," he said. "We have worked diligently, in cooperation with the international community, to help organise and mobilise a political opposition that is credible, because in the absence of a credible political opposition, it will be impossible for us to transition to a more peaceful and more representative and legitimate government structure inside of Syria."

Referring to reports of chemical weapons being used in Syria, he reiterated that he was awaiting a report from a UN investigation.

Obama announced an extra $200m in aid to Jordan to help cope with the influx of 460,000 refugees from Syria.

Abdullah echoed Obama's concerns about the danger of instability, citing the refugee problem and warning that the number of Syrians in Jordan double by the end of the year.

After touring the abandoned desert city of Petra on Saturday, Obama is scheduled to return to Washington.