Farah, a city of 50,000, would be the second Afghan city to fall to the insurgents since the war began. The northern city of Kunduz fell twice to the Taliban, in 2015 and 2016, but was retaken by the government both times.

In Kabul, Afghan officials said they would quickly expel the Taliban from Farah. “We are hoping to get control of the fighting in the city,” General Radmanish said at a news conference. “Our reinforcements are trying to use their capabilities to overcome the situation.”

By the end of the day that had not happened, but General Radmanish insisted the center of the city remained in government hands. “The governor’s office, the police headquarters, the National Directorate for Security, the university and the airport are under our control,” he said. “We are using all of our capabilities to change the situation there.”

Residents reached by telephone inside Farah late Tuesday all said the insurgents appeared to control most, if not all, of the city, other than the governor’s offices. “It is amazing how easily the Taliban managed to enter the city,” said one resident, Dill Agha. “They are telling residents to remain in their homes, that they are not hurting civilians or any military or police who surrender themselves.”

Fareed Bakhtawar, head of the Farah provincial council, said that he had joined volunteers to fight the Taliban but that the insurgents had taken large areas of the city. “There is no extra force to help us, and the situation is getting worse,” Mr. Bakhtawar said.

Fighting has been intense for months in the western province — much of which, outside of military bases, has already fallen under Taliban domination — with hundreds of police officers and soldiers killed. The fighting has increased in Farah because of Taliban reinforcements sent from neighboring Helmand Province, where the insurgents have fared less well in recent months, according to Afghan officials.

[Read how the Taliban and Iran have struck up an unlikely alliance in Farah Province.]

Qasim, a resident of the city who worked for a foreign organization, said he and friends tried to flee but were advised to hide in their homes because the insurgents were checking identification in order to find people like him. “The fighting is very fierce and it is very dangerous to go out,” he said. “All the people we know are trapped in their homes. We were told not to even peek outside.”