The Standard & Poor's rating agency on Thursday revised Morocco's outlook downward to negative from stable because of Europe's financial crisis, a high deficit and lagging reforms.

The agency affirmed its BBB- credit rating for Morocco, which hovers just above junk bond status, but the negative outlook creates the possibility that a downgrade might be in the cards. If Morocco were to sink to a junk bond rating, it could make it harder and more expensive to borrow on international markets and scare away foreign investors.

With its economy buffeted by a poor harvest and debt crisis hurting its main European trading partners, Morocco has a budget deficit this year of 7 percent of GDP. Despite declining revenues — including a drop in tourists — the government increased spending to avert social unrest brought on by the 2011 pro-democracy protests throughout the Arab world.

"The negative outlook reflects our view that we could lower the ratings if the fiscal and current account deficits do not narrow significantly and sustainably, social pressures escalate to a degree that they jeopardize political stability or impede coherent reforms, or economic performance is materially harmed by a weakening external economic environment," said S&P's statement.

Morocco sought help from the International Monetary Fund in August, winning a $6.2 billion precautionary credit line. The IMF says it offered the loan to help Morocco cope with fluctuating energy prices and the effects of Europe's economic troubles.

In exchange, the government promised to reform the pension system and a costly program of state subsidies for energy and staples.

S&P said that Morocco's ratings would stabilize at the current levels if the government succeeded in reducing deficits and lowering external debt ratios, all while maintain political and social stability.

This North African kingdom of 32 million was largely spared the social unrest that swept North Africa in 2011 due to political reforms carried out by the king and an election victory by an opposition party.

Vocal protests by the unemployed are frequent, however, and the drop in the growth rate from around 5 percent over the past few years to an estimated 3 percent in 2012 could exacerbate the unrest.