Egypt's military-dominated government has delivered a humiliating, public slap in the face to John Kerry, the US secretary of state, by sentencing three al-Jazeera journalists to long prison terms only hours after Kerry personally expressed his deep concern about the case in high-level meetings in Cairo. The snub represents a disastrous beginning to Kerry's already fraught Middle East tour, which took him to Baghdad on Monday for crisis talks about the Islamist extremist uprising.

The verdict, by a court responsive to government wishes, will also be seen as a deliberate, crude signal to President Barack Obama, who criticised Egypt's deteriorating human rights record after the former general, Abdul Fattah al-Sisi, seized power in a coup last year. Sisi has since had himself voted president. His elected predecessor, Mohammed Morsi, and thousands of his Muslim Brotherhood supporters remain in jail while hundreds of others have been killed.

In what US officials said were "candid" talks with Sisi, Kerry "emphasised our strong support for upholding the universal rights and freedoms of all Egyptians, including freedom of expression, peaceful assembly and association". He noted a number of promises by Egyptian leaders "are yet to be fulfilled", but added that "the United States remains deeply committed to seeing Egypt succeed".

The hollowness of all this careful diplomatic language was exposed for all to see by the court's verdict, which diplomats and observers said was reached without the complication of supporting evidence. It seems clear now that Kerry was wasting his breath; the sentences were pre-determined, intended as a stark warning to Egyptian and foreign media and as a symbol of the regime's determination to demonstrate its independence of Washington.

This is ironic given that, before the talks, the US had made available most of the $575m (£328m) in military aid frozen by Congress after the coup against Morsi. Kerry offered more blandishments in the form of 10 Apache attack helicopters, which he said would be supplied to Egypt "very soon". This is exactly the sort of deadly air power that Iraq's government has pleaded for but has so far been denied by Obama.

Kerry must now be asking himself whether it was entirely sensible to offer such diplomatic, financial and military support to Sisi unconditionally before their meeting and before the court announced its verdict. This is not the way hard-headed, worldly-wise American secretaries of state, such as Henry Kissinger, George Shultz and James Baker, would have gone about it. All old Middle East hands, they would surely have driven a tougher bargain. On the other hand, they would all probably have placed America's and Israel's strategic interest in a strong, stable pro-western Egypt above human rights issues. Perhaps this is what Kerry has done, too.

Whatever his reasoning, Kerry's record in the region has been similarly uninspiring. He invested considerable personal prestige, time and effort in pursuing resumed peace negotiations between Israel and the Palestinians, to no avail. This failure was entirely predictable, given the personalities involved on both sides and the lack of new ideas.

More serious, in immediate human terms, has been Washington's disastrous policy towards the civil war in Syria, where it appears to have achieved the worst of all worlds. More than three years on, Bashar al-Assad is still in power, the pro-western opposition has struggled for lack of support and millions have been killed or displaced, while the Islamist extremists of Isis (Islamic State of Iraq and Syria) and al-Qaida-affiliated groups have flourished and spread.

To be fair to Kerry, these policies and problems were inherited from his predecessor, Hillary Clinton, who with Obama failed abysmally to seize and nurture positive opportunities for democratic reform created by the Arab spring, Egypt being one of the worst examples. But the Isis emergency in Iraq has developed on Kerry's watch, and there are a growing number of voices in Baghdad, Irbil and Washington saying he and Obama missed or ignored the warning signs.

Kerry now faces the unenviable task of persuading Nouri al-Maliki, Iraq's stubborn and divisive Shia prime minister, to step down – or at least share power with representatives of the Sunni community – without the carrot of American military assistance to sweeten the deal. Obama has made it crystal clear that he wants no part of a "third Iraq war".

Even if Maliki bows to American demands, there is no certainty his government will survive or get the military backing it needs. Given weekend reports about the chaotic state of Iraq's army, the 300 "military advisers" the US has agreed to send can hardly make much difference, at least in the short term.

Last week's fantasy of a Washington-Iran axis to bring peace to Iraq has been comprehensively exploded by Ayatollah Ali Khamenei, Iran's supreme leader, who warned at the weekend against the intervention of any foreign country in Iraq's internal affairs. If the US ignores Tehran's viewand sends in its forces, it risks a repeat of the period from 2004 to 2008 when Iran cynically backed insurgents of all religious persuasions against the "Great Satan".

Iran remains Maliki's strongest backer. If Tehran's leaders insist he stay, there is little the weakened Kerry, lacking diplomatic and military ammo, can do. He says he wants Iraq's three main communities – Shia, Sunni and Kurd – to work together to secure the integrity and survival of the country. But at present all three are pulling violently in different directions. The bumbling Kerry is not the man to put this particular Humpty Dumpty together again.