Foreign affairs can be risky territory for American presidents, as Barack Obama surely has learned by now. A recent poll showed that the public’s regard for his handling of foreign issues has taken a tumble due to recent developments in the Middle East.

In chaotic Egypt, both sides in the seemingly endless political dispute are blaming the American president (but not his British, French or German counterparts). In Syria, where civil war has raged for two years, there seems to be no practical way for Obama to help end the conflict.

It would be nice to think that peace would prevail in Iraq once the United States withdrew its troops — that even though they were sent there on the basis of false intelligence (about Saddam Hussein’s alleged possession of weapons of mass destruction) the fighting had somehow ended with a positive result.

But since Obama brought home the last American troops, sectarian warfare has claimed thousands of lives. Just last Saturday, at least 21 Iraqis were killed in bomb attacks on two Sunni mosques in the capital, Baghdad. The victims were worshippers who had come together to pray after breaking their fast for Ramadan.

Sectarian killings have become commonplace in a nation bitterly divided between Sunni and Shia Muslims. In fact, more than 2,500 Iraqis have been killed since April, according to U.N. figures released last week.

The increase in violence highlights the enduring tensions between the Sunni and Shia communities, tensions fueled in part because Sunnis believe Prime Minister Nouri Maliki’s Shia-led government is marginalizing them. They may all be Muslims, but they’re not even close to being on the same side.

The same is true in Syria, where sectarian strife has practically destroyed the country (and dangerously weakened its economy). The rebels want help from the United States, but Obama is afraid — and rightly so — that any American weapons sent to them could easily fall into the hands of the militant jihadists who are fighting alongside the rebels (and increasingly fighting against them at the same time).

Egypt presents the president with an especially vexing problem. Under United States law, this country cannot provide funds to a government formed as a result of a military coup, but Washington is trying hard to find a way to define what has happened in Cairo as something less than a coup so that the money can continue to flow. It’s used to buy peace, supposedly.

But it sure looks like a coup. The military, acting as the nation’s self-appointed conscience, gave Egypt’s first democratically elected president, Mohamed Morsi, an ultimatum: Change his ways or be removed from office. Morsi, who seemed to have difficulty grasping the basics of democratic rule, didn’t comply and was ousted.

Understandably, his supporters were furious. What had happened, they asked, to their votes? One problem, for the United States, is that most of Morsi’s supporters are anti-American Islamists belonging to or sympathetic to the Muslim Brotherhood. Meanwhile, the pro-Morsi crowd blames Obama for not having done more to protect their fledgling democracy.

In short, Obama can’t win. But it’s difficult to see what any American president could, or should, do about the situation in Egypt, which for decades has been a loyal ally in the always-dangerous Middle East.