The abrupt fall of the Egyptian President Mohammed Morsi has left the tiny Gulf state of Qatar with a very big headache barely a week after a young and inexperienced Emir has taken charge.
The Qatari support for Islamists throughout the Middle East as a strategy to establish itself as a regional powerbroker now looks increasingly threadbare.
In Syria, President Bashar al-Assad is slowly but surely gaining the upper hand on rebel forces that have had substantial backing from Qatar but it is Egypt where the young Emir may be left holding onto a policy that has cost the Qataris billions while backing the Morsi government.
The strategy of support for Mr Morsi and the Muslim Brotherhood looked a shrewd one just a year ago. Egypt had emerged from its Arab spring revolution to hold its first fair and open presidential election. Mr Morsi won a slight majority.
Key to his election victory was the promise to revitalise Egypt's moribund economy. The Qataris positioned themselves to prime the pump with massive transfers of cash, some $10 billion (£6.5bn) since Mr Morsi came to power.
But this was not a charitable giveaway. It was in the nature of an investment. A Qatari economist told the BBC: "We couldn't stand by and let Egypt collapse", but the billions came with an expectation - "I'll give you the money, show me the outcome," he said.
The Qataris had already secured a lucrative deal to sell their gas to the Egyptians and they were proposing to heavily invest in the redevelopment of the Suez Canal.
The thinking was that with a functioning economy and a grateful nation, Qatar would be in pole position to capitalise on a resurgent Egypt.
But as Mr Morsi stumbled from one failure to another, the promised economic recovery never got off the ground.
On Wednesday that cost Mr Morsi his job and left the Qataris busy attempting damage control. Al Jazeera, based in the Qatari capital, Doha, and funded heavily by the royal family, carried a statement from what it called a foreign ministry source that said in part "Qatar will remain a supporter of brotherly Egypt".
And the new Emir Tamim sent best wishes to the interim Egyptian President Adly Mansour.
Michael Stephens, a Gulf analyst with Royal United Services Institute (Rusi) Doha agrees that damage limitation is the order of the day for Qatar.
"The Qataris got into bed with one side and now that side is out," he said.
Mr Stephens said that a senior Qatari businessman had told him "it's like we've dumped our girlfriend", but Mr Stephens said it is not quite as simple as that.
"The Muslim Brotherhood is out for now but in a fair and free election they could be voted back in."
Even so, Sheikh Tamim and his advisors will be scrambling to establish a new position on Egypt, one that for the time being at least extricates them from their close relationship with the Muslim Brotherhood while striving to protect the billions they have already invested.
And his task is made all the more difficult with the departure of the long-serving Prime Minister and Foreign Minister Hamad bin Jassim al Thani.
He was seen as the architect of an assertive Middle East foreign policy that saw Qatar backing Islamist rebels in Libya and securing American agreement to arm Syrian rebels, Islamist and non-Islamist alike (though the suspicion was that the Qataris were directing weapons to hardcore Islamist factions like the al-Nusra front rather than to secular rebels).
And of course the unwavering support - until the events of Wednesday - for Egypt's Muslim Brotherhood.
The prime minister left his twin posts at the same time that Sheikh Tamim took over. HBJ as he is known has been replaced as foreign minister by Khalid al-Atiyya.
Mr Atiyya will need all of his reputedly formidable intellect in assisting the new Emir to devise a foreign policy shorn of an Islamist agenda.
It was the aggressive pursuit of that agenda that annoyed Qatar's Gulf Cooperation Council (GCC) allies, neighbouring Saudi Arabia being the most important of those, but certainly the United Arab Emirates, which is in the midst of a harsh crackdown on a Muslim Brotherhood associated religious society al-Islah, may be forgiven for a bit of a gloat at the expense of the Qataris.
And both those countries will be looking to advance their position in Egypt at Qatar's expense.