By Zia Ur-Rehman and Salman Masood

September 6, 2016

The yellow-walled, colonial-era central prison in Karachi houses some of the city’s hardened criminals, but one of its inmates, Waseem Akhtar, still has a day job: He’s the mayor of Pakistan’s biggest and most tumultuous city.

Mr. Akhtar won election here on Aug. 24, a victory that was largely symbolic.

Mr. Akhtar belongs to the Muttahida Qaumi Movement, or M.Q.M., a political group that led this chaotic, violent city for decades through a combination of political guile, violence and intimidation. Now, the party is struggling in the face of a crackdown by the military, which has put Mr. Akhtar’s electoral victory in the cross hairs. The mayor continues to languish behind bars, and it remains unclear when he might be able to perform his official duties.

Mr. Akhtar took the oath in a park last Tuesday, transported there from his prison cell for the occasion.

“There are a lot of issues in the city, but with full determination and motivation, we will resolve all of them,” he said at his inauguration. “I will seek my freedom from the court. Otherwise, I will run the city by setting up an office in my prison cell.”

After the ceremony, he was returned to his prison barracks.

Mr. Akhtar, who was arrested in July, faces at least 22 charges, including that he ordered citywide riots in May 2007, when he was home minister of Sindh Province, and that he arranged medical care for wanted terrorists.

The judiciary has observed that a jailed official cannot perform official duties. Moreover, the military does not want Mr. Akhtar to take charge of Karachi, Pakistan’s economic hub.

Years ago, Mr. Akhtar developed a reputation as an aggressive leader, and he was chosen to defend the party and its exiled leader, Altaf Hussain, on news channels, and then to supervise municipal elections in the city’s two boroughs, where a splinter group challenged the party. When the party won a resounding majority last December, Mr. Hussain tapped Mr. Akhtar to be its nominee for mayor.

Karachi had last had a mayor in 2010. Elections were not held again until late last year because of wrangling over power sharing.

The sprawling port city’s residents, unofficially estimated to number 22 million, badly need a mayor to address civic problems.

Water is scarce; it is mostly delivered through tankers, with delivery ensured only by bribes. Gigantic piles of garbage are a common sight. Roads are in poor condition. Vast areas of the city look like slums, interspersed with high-rises and affluent gated communities. Worst of all, lawlessness, rampant street crime and a vicious circle of political violence have crippled the city for decades.

Mr. Akhtar, 60, a tall man with salt-and-pepper hair and mustache, has promised to solve Karachi’s immense problems. But for now, he is the butt of jokes. One widely circulated quip: “Waseem Akhtar said he would take everyone along. And then he went to prison.”

Since 2013, a crackdown by the Sindh Rangers, a paramilitary force answerable to the military, has targeted M.Q.M., portraying the party as the main obstacle to bringing peace to the city.

Mr. Hussain, the party’s leader, lives in self-imposed exile in London, where he was said to control this city through phone calls, with the help of loyal armed gangs on the ground. Of late, however, he has been weakened. Besides having problems with the military, Mr. Hussain has been the focus of corruption and murder inquiries by Scotland Yard.

The M.Q.M. headquarters building in Karachi, widely known here as Nine Zero, was raided twice in 2015 by the Rangers. Several of the movement’s local leaders are behind bars, and some have bolted to the Pak Sarzameen party, a new political group led by Mustafa Kamal, who was the mayor until 2010.

Mr. Kamal parted with Mr. Hussain in March, a move widely believed to have the support of the paramilitary Rangers.

Mr. Hussain’s shrinking control over the city has frustrated him. On Aug. 22, he made an incendiary speech, urging followers to attack television news networks that do not cover him. Within minutes, enraged protesters ransacked the offices of one of the networks, and ensuing violence left one person dead. Afterward, the leadership of M.Q.M. moved to sever the movement from him.

The Rangers have kept increasing the pressure. Since Aug. 22, law enforcement authorities have demolished at least 68 M.Q.M. party offices and sealed 180 more, citing allegations that they were illegally constructed.

Farooq Sattar, an M.Q.M. member of Parliament, has condemned the move and accused the authorities of a vendetta. He said in an interview that the crackdowns, coming after the party’s earlier severing of links with the London-based leadership, “compel us to presume that authorities’ agenda is beyond Hussain and his anti-Pakistan speeches.”

Analysts say the military’s campaign has seriously damaged the M.Q.M.

“The M.Q.M. has been dead for a while. Its vote bank remains, but the party has lost its aura,” Laurent Gayer, a French scholar and the author of the book “Karachi: Ordered Disorder and the Struggle for the City,” said in an interview.

For now, the new mayor is in legal limbo, spending his time much as any other inmate does.

Mr. Akhtar is not allowed meetings with the public or the news media, though his family members and some party leaders are allowed to see him.

As a political prisoner, he has access to a few amenities: a refrigerator, a television and a stove, according to reports in the local news media. He is allowed to use them until 6:30 p.m., when he must retire to his cell.

Many residents and commentators say M.Q.M. should have chosen a different candidate after the military establishment showed resistance to Mr. Akhtar.

“We are pessimistic that the new mayor will resolve the civic issues,” said Zahid Farooq, an official at the Urban Resource Center, a nonprofit organization in the city. “It will make matters worse.”

He added: “Obviously, the mayor should be on the ground to do his work. How will an imprisoned mayor run the city?”