LISBON, Portugal — Portugal's president has accepted a compromise reached by the coalition government that allows it to stay in power, defusing a crisis that had roiled financial markets.

In an address to the nation, President Anibal Cavaco Silva ruled out early elections, opting for "the best alternative" which is "the continuation in office of the current government."

The coalition nearly split July 2 when Foreign Minister Paulo Portas, the leader of the junior party, threatened to resign.

A compromise was reached within the coalition when Portas was appointed deputy to Prime Minister Pedro Passos Coelho, but this step required the president's agreement, which he gave late Sunday.

The political dispute had raised fears that Portugal would be unable to abide by the terms of its 78 billion euros ($102 billion) international bailout.