As they walked away from the rubble of their destroyed homes, the people of KaShali could see in the distance the newest lavish palace of the man who ordered the demolitions: the King of Swaziland.

King Mswati III, the last absolute monarch in Africa, has ruled Swaziland for 25 years, banning all political parties and placing himself above the law. But when he tried to demolish hundreds of houses on farmland near the country's biggest city, the homeowners did something unexpected: They fought back in the courts – and won a ruling in their favour.

The court battle was part of a wave of legal challenges, strikes, boycotts and protests that have dented the dominance of the Swazi monarch, inspired by the popular uprisings that began in North Africa and spread across much of the continent this year, from Uganda to Burkina Faso.

Story continues below advertisement

After 18 homes were bulldozed at KaShali, nearly 300 residents banded together to win a court order against the King's attempt to evict them. "He was trying to scare us," said Senator Clement, the 39-year-old chairman of a committee of residents at KaShali.

If the King was trying to intimidate the homeowners, it didn't work. Mr. Clement fearlessly confronted the dozens of police officers who accompanied the bulldozer as it levelled the first houses. Then he led the court challenge against the King's men.

"He wanted to sort us out, like a bully," Mr. Clement said. "But he becomes very unpopular when he does this."

He points to the horizon, where one of the King's many palaces is visible a short distance from KaShali. Soldiers and police are camped outside the palace to protect it from the threat of protests – a sign of the monarch's declining legitimacy.

King Mswati and his father before him have been revered, even worshipped, for decades by Swaziland's deferential citizens. But the reverence is fading. Swaziland faces a financial crisis, exacerbated by the King's mismanagement, that has led to school closings, shortages of medicine, delays in pensions and cuts in university enrolment. A mounting appetite for democratic freedoms, fuelled by the street revolutions in North Africa, has further eroded the King's popularity.

In one of the most influential protests against the monarchy this year, Swaziland's lawyers organized a four-month boycott of the country's courts, throwing the judicial system into turmoil as the lawyers successfully campaigned for legal reforms to reduce the King's power and ensure the independence of the courts.

The lawyers were angered by the growing signs of authoritarian rule in Swaziland, including the suspension (and eventual sacking) of a Supreme Court judge who had allegedly shown disloyalty to the King. The judge was accused of supporting "regime change" in Swaziland, but analysts say he was suspended because he insisted on judicial independence.

Story continues below advertisement

When the lawyers held a meeting to discuss the issue, it was stormed by police armed with shotguns and tear gas. But they continued their boycott for months, holding frequent protests in the streets to demand the rule of law.

Of the 180 members of Swaziland's law society, nearly all joined the boycott – even though it meant the loss of more than half their income. They faced harassment and surveillance by the police, threats to their families, and monitoring of their phone calls and e-mails, yet they refused to bow to the pressure.

The boycott finally ended in late November. By that time, dozens of Swazis had been tossed into prison for minor offences because they had no legal representation. When the boycott was over, the lawyers went back to work, filing appeals to free those who were unfairly imprisoned.

One of the key grievances that sparked the boycott was a new policy by the Chief Justice, a royal appointee, which prohibited Swazi citizens from filing lawsuits against any corporation in which the King owns shares. Instead of merely putting the King above the law, the new policy meant that all of his many corporate interests were above the law as well.

In the end, the boycott forced the government to back down on this policy, ensuring that the King's companies would not be immune to legal challenges.

"It was a bit of a surprise to the authorities that we held out and fought on a point of principle," said Zwelethu Jele, one of the leaders of the boycott.

Story continues below advertisement

"We've laid down a marker for the rest of society. Now they know that they can achieve something if they try. The limits have been pushed, and now it's just a matter of time."

Mr. Jele believes the boycott was a sign of Swaziland's increasing willingness to fight the King's autocratic rule. "The tolerance levels in this country are getting thinner and thinner," he said. "The country is on the verge of a political explosion."