LISBON, Portugal — Portugal's president said Wednesday he is keeping faith with the bailed-out country's troubled coalition government and rejecting opposition parties' demands for an early election, though he appealed to all the main parties to put aside their differences and find a broad compromise that will spare the Portuguese from needing a second financial rescue.

The government came close to collapse last week when the two coalition partners disagreed over the scale of austerity measures. The finance and foreign ministers resigned, triggering what President Anibal Cavaco Silva called "a grave political crisis" over the past 10 days.

The dispute cast doubt on Portugal's ability to comply with the debt-cutting demands of a 78-billion-euro ($100 billion) bailout it received two years ago. Other countries using the euro currency worried that Portugal's difficulties could hurt the bloc's efforts to escape its prolonged financial crisis.

In a 30-minute broadcast to the nation in a prime-time evening slot, Cavaco Silva said a snap election would be "extremely negative" for Portugal's credibility as it tries to recoup the faith of investors who are keen to see political stability that can push through fiscal and economic reforms in the debt-heavy country.

Holding early elections would consign Portugal to 82 days of virtual political paralysis, Cavaco Silva said. By creating "huge" political and financial instability, a ballot likely would make it necessary for the country to ask for more financial help, he said.

He urged the three parties which signed the 2011 bailout agreement — the Social Democratic Party and smaller Popular Party, which are in government, and the main opposition Socialist Party, which was in power at the time of the bailout — to find common ground and "put the national interest above their own parties' interests."

The head of state, though he has no executive power, is responsible for ensuring the country has a stable government. Cavaco Silva spent three days consulting with political parties, business leaders, labor groups and economists before announcing his decision Wednesday.

The sudden political discord in Lisbon after two years of relatively stable government took many by surprise.

Portugal has broadly stayed on course with its program of spending cuts and economic reforms, drawing comparisons with Ireland's record rather than that of more tumultuous Greece — euro area countries which have also needed rescues.

If Portugal doesn't abide by the terms of the rescue, its bailout creditors can cut off funds and leave the country at the mercy of financial markets. The three major international ratings agencies have downgraded Portugal's credit worthiness to junk status.

Paulo Portas, head of the Popular Party, which is the junior coalition partner, quit as foreign minister in disagreement with plans for more deep cuts this year and next year. He said he wanted a new emphasis on job creation and economic growth as the country weathers an expected third straight year of recession amid a jobless rate of 17.6 percent.

Prime Minister and Social Democrat leader Pedro Passos Coelho has promised a Cabinet reshuffle which, he says, will restore harmony in the coalition.