MAIDAN SHAR, AFGHANISTAN—Zarifa Ghafari, who at 26 became one of Afghanistan’s first female mayors, has said that she fully expects to be assassinated.

Not that she is keeping a low profile.

After taking office in March in Maidan Shar, a town of 35,000 in Afghanistan’s Wardak province, she had a banner hoisted with her name, a picture of her wearing a bright red head scarf and the slogan of her anti-littering campaign: “Let’s keep our city clean.”

Ghafari is well aware that she is on the front lines of the struggle for women’s rights in Afghanistan, at a time when recent U.S. peace talks with the Taliban have Afghans thinking about what might happen if the ultraconservative insurgents ever take part in running the country again.

“My job is to make people believe in women’s rights and women’s power,” she wrote on Twitter.

Ghafari is not the first woman to take over a traditionally male job in Afghanistan’s patriarchal society. But she has one of the toughest imaginable positions.

Women have been appointed as governors of Daikundi and Bamiyan provinces, which are culturally tolerant areas by Afghanistan’s standards. For two years, Nili, a town in Daikundi, had a female mayor. She eventually moved to the United States.

But Wardak is a particularly conservative province, where support for the Taliban is so widespread that many major highways are not safe for civilians.

Maidan Shar’s only high school for girls had just 13 graduates last year. Before Ghafari became mayor, the only woman in town to have held a government job other than teacher was the head of Wardak’s women’s ministry, and she did not dare live in the city, instead residing in Kabul, the country’s capital. Ghafari also commutes from Kabul for safety reasons.

Ghafari was actually appointed in the summer of 2018 by Afghanistan’s president, Ashraf Ghani. But after a disastrous first day as mayor, her term was delayed for months.

After she arrived for work that July day, her office was mobbed by angry men brandishing sticks and rocks. She had to be escorted out by Afghanistan’s intelligence agency, the National Directorate for Security, which sent a squad of paramilitary officers to her rescue.

“That was the worst day of my life,” she said.

“Don’t come back,” protesters jeered as she left. Among them, she said, were supporters and aides of Wardak’s governor, Mohammad Arif Shah Jahan, whom she accused of orchestrating the protest because he opposed the appointment of a woman. Attempts to reach Jahan for comment were unsuccessful.

Ghafari left town, but not quietly. “I was screaming so much I lost my voice,” she said. She went straight to the presidential palace in Kabul and told the officials there she would not give up easily.

“I told them I will claim my right to office if I have to set myself on fire in front of the palace,” she said. “It was not an idle threat.”

It took nine months, but Ghafari finally managed to return — after Jahan resigned, and after she had made a social media pest of herself with the hashtag #IWillFightforRight. But that did not mean that her troubles were over. Far from it. That became quickly evident on a visit to Maidan Shar to see Ghafari in action.

She started by convening a meeting of 20 municipal officials, all men. Or trying to. Some came in late. Many refused to look up from their cellphones. Several talked among themselves, ignoring Ghafari, until she finally shouted at them. “This is a formal meeting,” she said. “If someone has personal business, he can leave.”

With that, they settled down and listened for a few minutes.

“Get back to work and do your jobs,” she said as she adjourned the meeting. Loud laughter could be heard from the room after she left.

Out on the street, she took a group of municipal cleaners and mayoral aides to distribute plastic trash bags for her Clean City Green City campaign. She was reluctant to let a reporter come along. “I don’t have any bodyguards,” she said. “According to policy I should have two. It’s not safe out there.”

The reason for her concern was immediately clear. At the bazaar, a crowd of men and boys gathered as soon as she appeared, pressing closely around her.

Loading... Loading... Loading... Loading... Loading... Loading...

Most refused to take a trash bag. Garbage was strewn all over the streets. Ghafari held her ground, often yelling at the top of her voice, demanding that people take the free bags and use them. “It’s our city; we should keep it clean,” she said. “I can’t do this without your help.”

Some laughed at her. But others accepted the bags. Only one woman was at the scene, wearing a head-to-toe burqa.

Ghafari later apologized to a reporter for her aggressiveness. “When a lady wants to work in a very conservative society, she has to hide her real personality,” she said. “She must be harsh, or no one will listen to her. I need to prove to them that women are not weak.”

A member of the Pashtun ethnic group, like most people in Wardak, Ghafari is the daughter of a high school teacher and a colonel in the Afghan special forces. She is single, although 26 is considered a late age to be unmarried in Afghan society.

She said she had already received death threats from the Taliban and the Islamic State. “I know I will be assassinated, but it’s not them I’m afraid of,” she said.

Much more worrisome, she said, were criminal syndicates on the government’s side of the war, involved in the highly corrupt and lucrative trade in land.

“The land mafia are the ones who really scare me,” she said. “One of them came up to me and said he would put a bullet in my head if I didn’t leave here.”

Ghafari had never expected to work in government. She earned her bachelor’s degree in India and was studying for her masters in economics when, during a visit home last year, her family encouraged her to sit for a competitive civil service exam. Ghani had instituted the exams to bring merit-based hiring to appointments.

In addition to her studies, Ghafari was an entrepreneur, having started a popular radio station aimed at women in Wardak. She was back in India working toward her degree when a friend called. She said Ghani’s office had announced on Facebook that Ghafari had been named mayor of Maidan Shar.

“I didn’t believe I could get this job, because I am a person with neither political power nor gold,” she said. “But when I did, I knew I wanted to be here and try to change society.”

Ghafari’s doggedness has won her some grudging respect, despite the contempt she often encounters. After her humiliating municipal meeting, she seemed unfazed.

“Sometimes it seems that everybody is just against women, and when a woman is active in society, they can dismiss you as an immoral woman,” she said.

But in a later meeting at the governor’s office, about a road project that Ghafari had championed, there was a glimmer of support for her.

“Give her some credit,” one of the men present told the other. “That project was stopped for 12 years, and she is here for a month, and it’s restarted. She may be a woman, but she is powerful.”