The Taliban said Saturday they have entered the Panjshir Valley, the only remaining area of armed resistance to their rule in Afghanistan, as they continued talks on the formation of a new government.

The Taliban’s claim comes ahead of a visit by U.S. Secretary of State Antony Blinken and Defense Secretary Lloyd Austin to Qatar, where they are expected to discuss safe passage for Afghans seeking to flee the country as well as human-rights issues, including those of Afghan women. On Saturday, the Taliban roughly broke up a protest by women in Kabul.

Panjshir, a valley protected by a ring of mountains, is the only part of the country the Taliban didn’t conquer in a lightning blitz that culminated with their capture of Kabul on Aug. 15.

A Humvees bears the Taliban flag near the southern entrance of Panjshir in Afghanistan.

Photo: social media/Reuters

The Taliban posted a video Saturday showing what they said were their fighters, in seized U.S.-supplied Humvees, on a mountainside road in Panjshir. It wasn’t clear from the footage where and when it was filmed.

A resistance supporter confirmed the setback, saying the Taliban had entered Panjshir from both the south and the north.

Emergency, an Italy-based nongovernmental organization, said the Taliban had reached the village of Anabah, Panjshir, where it runs a medical center. It said it had received a small number of wounded at the facility, which is continuing its work.

Officially, however, the rebels denied that the Taliban had made inroads.

When the last Taliban regime was in power, from 1996 to 2001, it failed to enter Panjshir, where the resistance was then led by Afghan military commander Ahmad Shah Massoud. His son, Ahmad Massoud, who has no previous experience of fighting, is the current leader of the rebels.

Panjshir, home to the country’s Tajik ethnic minority, also held out against the Soviet invasion of the 1980s.

“We will never stop fighting, struggling for God, freedom and justice,” Mr. Massoud said in a post on Facebook on Saturday.

In Kabul, Taliban fighters and some supporters celebrated by shooting in the air, causing casualties. Two hospitals said they had received a total of two dead and about 16 injured.

Separately, women have staged several protests since the Taliban cemented their takeover, including in recent days in the remote southwestern province of Nimroz and the western city of Herat.

When the Taliban was last in power, women were banned from education and couldn’t leave the house without a male escort.

This time, the Taliban have tried to project a more moderate image regarding women, pledging to respect their rights within the limits of Islam but without explaining what those limits will be. They have said women should stay home until their fighters are educated and sensitized to women’s rights, but haven’t offered any time frame.

In a protest Saturday in Kabul, a small group of women held placards, one of which read, “We are not women of the ‘90s.”

“Taliban, Taliban: The violators of women’s rights” and “With the weapons of education and knowledge, we defend our rights,” read other banners.

Razia Barakzai, the organizer of the march, said that when protesters neared the ministry of finance, the Taliban blocked their way and started beating them, firing tear gas and bullets in the air. One of the demonstrators was injured seriously, she said.

“We want our rights, our equal rights like other human beings. We want to have participation in politics and social affairs,” she said.

Resistance fighters on a hill in Panjshir in Afghanistan.

Photo: national resistance front of afg/Reuters

She said it was painful that when the Taliban were attacking them, men passing on the road stood and watched. She said the Taliban followed each of them home and now know where they live.

A picture of another woman at the protest with blood coming down the side of her face was circulated on social media.

The Taliban are still in talks on forming a new government. On Friday, Mr. Blinken said the U.S. wanted to see the Taliban establish a government that includes other Afghan factions and that refrains from reprisals against opponents.

Mr. Blinken, who arrives Sunday in Qatar, has said Washington also wants the Taliban to allow freedom to travel for Afghans.

“We continue to maintain channels of communication with the Taliban on issues that are important to us,” Mr. Blinken said. U.S. officials separately said Mr. Blinken doesn’t have plans to meet with the Taliban in Qatar, where the group has its political office.

Mr. Austin will depart Sunday for a visit to Qatar, Kuwait, Bahrain and Saudi Arabia. Washington says it is working with Qatar and Turkey to reopen the airport, which would enable more Afghans to leave the country. Mr. Blinken said Friday that out of the 124,000 people evacuated in the second half of August, 75% to 80% were Afghans at risk from the Taliban.

On Saturday, the head of Pakistan’s Inter-Services Intelligence spy agency, Lt. Gen. Faiz Hameed, arrived in Kabul. The Pakistani military didn’t comment on his agenda.

Western governments, including the U.S., have accused Islamabad of supporting the Taliban, charges that the Pakistani government denies. Meanwhile, Islamabad is concerned that it will face a wave of refugees, and it is also worried about anti-Pakistan extremists in Afghanistan. Western governments have asked for Pakistan’s help in getting remaining citizens and at-risk Afghans out of Afghanistan.

Write to Saeed Shah at saeed.shah@wsj.com and Ehsanullah Amiri at Ehsanullah.Amiri@wsj.com