KABUL — The Afghan government has reversed Kabul authorities’ ban on schoolgirls older than 12 singing in public at official ceremonies after a mounting backlash, including a social media campaign of videos uploaded by Afghan girls and women singing their favorite songs in protest.

The ban was issued last week by Kabul’s education directorate in the form of a letter, and the criticism — including from officials — was almost instantaneous. Within days, dozens of videos marked with the hashtag #IAmMySong were uploaded to Facebook, Twitter and other social media platforms.

In a statement late Saturday night, the federal Education Ministry said the ban “does not reflect the positions or policies of the Ministry” and it was investigating the matter.

The controversy comes as Afghan leaders are negotiating with the Taliban to end decades of war. The peace talks underway in Qatar are intended to tackle issues such as the rights of women and minorities, but the sides have not officially discussed such matters. Many activists fear that if a power-sharing government is formed, gains made over the past 20 years in areas such as civil liberties and women’s rights could be lost.

Overturning the ban “was a small victory for us,” said Fariha Easar, a 32-year-old activist who was one of the people spearheading the #IAmMySong campaign. Easar said some officials are attempting to implement increasingly conservative policies ahead of the Taliban potentially assuming formal power in Afghanistan.

“We already know how the Taliban defines women’s rights,” Easar said. When the Taliban held power in the 1990s, schools for girls were forcibly shut and women were largely excluded from public life. “That’s why we cannot stop our movement.”

The Education Ministry statement said it supports the participation of “all students” in social activities, including singing groups, “and takes pride in their involvement.”

A negotiated end to the conflict in Afghanistan will almost certainly require the incorporation of Taliban leaders into a political system. A recent U.S. draft peace plan suggests an interim government in which power would be divided and the formation of a religious committee that would provide the government with guidance and advice. The interim government would retain power only until elections could be held.

Afghanistan largely remains a deeply conservative country, but since the toppling of the Taliban two decades ago by U.S.-led forces, many women, particularly in urban areas, have enjoyed expanded rights and freedoms.

Afghan government officials have pledged to preserve human rights gains, including the rights of women. Waheed Omar, President Ashraf Ghani’s senior communication adviser, was among a handful of officials who spoke out against the singing ban before it was reversed.

“No individual or institution is allowed to set limits on the citizens of this country that contradict the spirit of this country’s constitution,” Omar tweeted Saturday.

But Easar and other activists fear their work will become more difficult and dangerous in the months ahead.

Violent attacks against women in Afghan public life have increased as security in the country has deteriorated. Three female media workers were killed this month on their way home from work in eastern Afghanistan. And in January, gunmen killed two female Supreme Court judges in Kabul.

“We won’t let anyone silence our voices. We should stand up for the future of our daughters,” activist Laila Frogh Mohammadi posted on Twitter along with a video of her singing a popular Afghan song.

“It is difficult, but we must pass through,” she sang.

George reported from Doha, Qatar.