LONDON – After days of skyrocketing alarm among investors, the leaders of Europe’s two heavyweights, France and Germany, reached agreement Friday on a key element of a second rescue package to help debt-ridden Greece avert a potentially catastrophic default.

Meeting in Berlin, German Chancellor Angela Merkel and French President Nicolas Sarkozy appeared to resolve a running dispute over whether to force private holders of Greek bonds to participate in the bailout, which many are loath to do. The two leaders agreed that such investors would take part only on a voluntary basis.

European markets, which had been hammered over the past few days out of concern over Greece, immediately rose on the news of a rapprochement between Merkel and Sarkozy and on the back of a shakeup of the government in Athens.

Investors have been worried that Greek Prime Minister George Papandreou will be unable to win parliamentary approval for a new round of austerity cuts to bring down his nation’s massive budget deficit. That and European infighting over whether to extend more emergency aid to Athens fueled market fears this week that Greece would slide into bankruptcy.

Huge public protests in Athens against the austerity package have also shaken investor confidence.

In a reshuffle of his Cabinet on Friday, Papandreou booted his unpopular finance minister and appointed in his place a powerful fellow Socialist Party member who analysts say is capable of delivering the votes in parliament that Papandreou needs.

“The country must be saved and will be saved,” new Greek Finance Minister Evangelos Venizelos told reporters, adding that he accepted the post as his “patriotic duty.”

Papandreou will present his new ministerial lineup for a vote of confidence in the parliament next week.

In Germany, Merkel appeared to back down from her insistence that private holders of Greek debt be forced to participate in a second bailout of the Mediterranean nation by extending the maturities on their bonds. Many Germans believe that such investors should not be given a free pass in the crisis while taxpayers are on the hook to rescue Athens.