Moroccans have voted in local polls seen as a test for the ruling party, which took power nearly four years ago after protests prompted reforms by the king.
About 50 percent of the 15 million eligible voters cast their ballots in the municipal and regional polls on Friday. The polls are considered a gauge of the popularity of Prime Minister Abdelilah Benkirane and his government, a year ahead of a general election.
With 80 percent of votes counted, the opposition Authenticity and Modernity Party had a narrow lead, with 20 percent of the votes.
The ruling Justice and Development Party (JDP) had 17 percent.
In 2011, Benkirane's PJD became the North African country's first party openly promoting Islamic values to win a national election and lead a government.
About 32,000 seats on local and regional councils were at stake in Friday's vote.
Benkirane, who voted in the capital, told the AFP news agency that "Morocco is taking a decisive step towards democracy".
Habiba Ramzi, a voter, said she hopes that those elected "will think about the poor this time".
"To those candidates I say enough corruption and lies," she said, adding that she wanted to see more done to improve education.
A total of 140,000 candidates are standing, and 76 foreigners are among 4,000 election observers.
Benkirane remains popular in the conservative country, despite limited success in tackling corruption, and is credited with lowering the budget deficit to less than five percent of the gross domestic product from seven percent.
His main rival, Authenticity and Modernity Party leader Mustapha Bakkoury, has criticised his rule.
"His priority over the last four years has been his own clan, rather than all the people of the country," said Bakkoury, a close adviser to the king.
With less than half of registered voters taking part in the election of November 2011, Friday's turnout was being closely watched for an indication of the state of political transition.
"In a Morocco that is learning to walk along the path of democracy, participation in elections is not a luxury; rather, it is the first step along the road to building the future," independent daily Akhbar Al-Yaoum said.
Mohamed Madani, a professor of political sciences at Rabat's Mohammed V University, said the elections will serve as a "springboard" for parliamentary polls due next year.
Source: Al Jazeera and agencies