You’d be hard pressed to find a greater contrast last week in the Middle East than Libya and Morocco. While the bloodbath continued in Libya, Morocco was a completely different story. Libyans were fighting for their lives; Moroccans were listening to an unusual speech:

Morocco’s King Mohammed VI promised sweeping constitutional reforms, including real powers for a popularly elected prime minister instead of a royal appointee, as well as a free judiciary.

In his first speech after uprisings across the Arab world and less than a month after protests erupted in Morocco for more social justice and limits on royal powers, the king Wednesday pledged to draw up a new draft constitution.

“We have decided to undertake a comprehensive constitutional reform,” King Mohammed said, underlining his “firm commitment to giving a strong impetus to the dynamic and deep reforms... taking place.”

He outlined seven major steps, including the way the prime minister is chosen.

Libya is convulsed in a war that will, absent decisive action by the West, go on for some time. Meanwhile, Morocco will be having a national debate:

The Moroccan monarch announced the formation of a commission to work on the constitutional revisions, with proposals to be made to him by June. A referendum will then be held, he said, without giving a date.

The live broadcast was the first time the king has delivered an address to the nation since thousands of people demonstrated in several cities on Feb. 20 demanding political reform and limits on his powers.

They were the first protests in the country since the start of the uprisings across the Arab world that toppled the presidents of Tunisia and Egypt this year.

There have been other peaceful rallies since then, including in the capital, Rabat, and the country’s biggest city, Casablanca, with young activists campaigning for greater democracy using the Facebook social network to call for new demonstrations on March 20.

To put it simply, this is a big deal in Morocco. In the first protest Feb. 20, Moroccans took to the streets to demand more accountability and constitutional reform. Much of their anger was directed at the parliament and the political parties. The king, instead of cracking down, decided to speed up a process of decentralization and deconcentration of power. The idea is to move power and authority out of Rabat and devolve it to local elected bodies.

That will entail monumental challenges for a country where local figures have not had responsibility for governance. The opportunity for graft is real and significant. To say there will be a steep learning curve would be a vast understatement.

The speech was praised by France and Spain. The United Nations. and then, belatedly, the Obama administration added their commendations. The message was delivered by a State Department spokesman, rather than the secretary of state. Obama was characteristically silent. Last year, however, Hillary Clinton did praise Morocco as a “model to follow.” Unfortunately, it is not a model she personally cared to tout last week.

So why is Morocco’s political ethos so different from its neighbors? Talking with talking with diplomats, Moroccan officials and Middle East experts yields a general consensus: the Moroccan monarchy. For centuries the monarchy has been a symbol of unity in a country with a variety of languages and substantial regional differences. Moreover, as the highest religious authority in the country as well as its ruler, the Moroccan monarchy enjoys a legitimacy and respect that Moammar Gaddafi, Hosni Mubarak and Ben Ali could only dream of.

But it is also true that this particular king has been on a reform path for 20 years. He championed a new family code that granted rights to woman unprecedented in Muslim countries in the region. He has also promoted efforts at economic diversification and a “human development initiative” that has been building infrastructure at a furious pace. (A group of journalists who returned from a recent trip describe a country that looks like one giant construction site.) That program focuses on the 600 of the most disadvantaged communities and seeks to make regional capitals (e.g., Marrakesh, Tangiers) more attractive and livable, with modernized roads, medical facilities, and schools as well as new roads, and water and sanitation systems. All of that, the Moroccan government hopes, will prevent Casablanca from becoming a megalopolis like Mexico City or Buenos Aires. The most visible sign of success is the disappearance of squalid shanty towns in many areas, especially in the south.

What can the United States and, more important, Morocco’s neighbors, learn from the king’s approach? For the United States, this should be a reminder that Morocco is an ally that America can and should work with. To the extent Obama has adopted the “Freedom Agenda” as his own, he’d be wise to provide financial, political and technical assistance as Morocco embarks on a challenging process of reform. Aside from money, the conversion to a more democratic system of local rule will require training in everything from urban planning to accounting for hundreds of local officials. As for Congress, this probably isn’t the time to decrease aid to the one uber-stable Muslim country in the region.

But most critically, Morocco can serve as an example to others in the region that the best defense against both Islamic radicals and secular revolutions is a modernizing country that provides young people with the opportunity for economic success and political freedom. Those not yet enveloped in the flames of revolution should think hard about the Moroccan example.