The author is a Reuters Breakingviews guest columnist. The opinions expressed are his own.

Greece’s deal with its euro zone creditors after a marathon summit leaves a bitter aftertaste.

Berlin was right to point out that Athens had lost Europe’s trust. But by pushing the Greeks so hard – and initially proposing ideas that also could be portrayed as humiliating – Germany came close to losing Europe’s trust. Both leaders, Greece’s Alexis Tsipras and Germany’s Angela Merkel, need to work hard to rebuild it.

That said, the summit’s eventual outcome seems reasonably fair if tough. Germany’s most inflammatory ideas – that Greece should take a five-year time-out from the euro and transfer 50 billion euros of assets to a fund based in Luxembourg – were dropped. There’s now no talk of Athens bringing back the drachma; and the new “privatisation” fund will be based in Greece.

Still, Berlin’s initial approach has damaged its image in the rest of Europe. It led to the Twitter hashtag “ThisIsACoup” becoming the second most popular in the world. Its hard line at one point even threatened to drive a wedge between Germany on one side, and France and Italy on the other.

Athens, meanwhile, will have to pass a slew of long-delayed reforms in just a few days. Most of these – such as making the pension system sustainable and streamlining value-added tax – are desirable and should, in time, improve Greece’s economic performance.

But the country’s immediate prospects are bleak. This is mostly due to the government’s self-inflicted wounds. Tsipras could last month have agreed a deal less tough than the one he ultimately signed. Instead, he called a referendum to reject the proposal, triggering a chain reaction that led to the banks being closed and the economy taking a dive. He didn’t even manage to secure relief of Greece’s debt burden through this disastrous manoeuvre. The creditors only agreed to consider this after Athens starts implementing the reforms.

Although euro zone leaders have agreed to start negotiations on a new 82-86 billion euro Greek bailout, several things remain unclear.

Most immediately, how will Athens avoid defaulting on the 3.5 billion euros it needs to repay the European Central Bank on July 20? Since there won’t be time to negotiate a comprehensive deal by then, the leaders have told their finance ministers to work urgently on bridge financing.

Another immediate question is whether the ECB will authorise any more emergency liquidity for the country’s banks. If not, they will run out of cash within days.

The best guess is that the ECB will dribble out liquidity to keep the banks ticking over – either immediately or as soon as the Greek parliament passes the first reform measures. But there won’t be a decisive relaxation of capital controls until a new stress test of the Greek financial system is completed after the summer and the banks are recapitalised. Even then, the controls may linger for months, damaging the economy.

It is also unclear how the banks will be recapitalised. Although the euro zone will provide some money to do this, the suspicion remains that uninsured depositors may be “bailed in” – with some of their money converted into new bank capital. The creditors should resist this temptation, as it will savage the working capital of Greek companies and exacerbate the downturn. It will also send a bad message to those patriots who kept money in the banks during this terrible period.

A further question is how much Greece will have to squeeze its national budget. The agreement says Athens should agree to unspecified “ambitious targets” and that there should be “quasi-automatic” spending cuts if it deviates from them. There is a risk that the targets will be set unrealistically high and that Greece will get trapped again in a downward spiral – where more cuts further damage the economy making it, in turn, harder to hit the targets.

Probably the biggest uncertainty is what sort of government will implement the deal. After all, Tsipras can no longer count on at least 32 of the 149 members of parliament from his radical left Syriza party who think he has made excessive compromises. Even adding the support of his small coalition partner, the Independent Greeks, he lacks a majority in the 300-member parliament.

One option is for Tsipras to form a national unity government with the help of the pro-European opposition parties. Another is to call an election in a month or so, kick out the Syriza rebels, and hope to form a new government on his own but with more moderate MPs.

Either scenario is better than the status quo. So Tsipras will have a reasonable chance of rebuilding trust with his creditors. But he must also appoint to his cabinet people who are serious about implementing the agreement. This will also boost confidence among investors and depositors, enhancing the chance that the economy can start growing again.

If the Greek prime minister chooses a national unity government, he could further bolster trust by holding a new referendum to undo the damage of the previous one. A resounding “Yes” vote in such a plebiscite would protect Tsipras in the coming difficult months from the accusation that he lacked democratic legitimacy for the measures he was implementing.

Meanwhile, Merkel needs to reflect on the last few days. She should appreciate that fair Europe cannot be a punitive one. In time, trust may be restored on all sides and Europe may emerge stronger from the Greek crisis. But there is a lot of work to do.