KABUL, Afghanistan — A 3-year-old girl in Kabul has contracted polio, the first confirmed case in the capital in 12 years, health officials said Tuesday.

Afghanistan is one of only three countries where polio is still endemic, and it has been inching closer to its goal of eradicating the disease. But it is next door to Pakistan, where polio is much more widespread, especially in the tribal areas along the border, and most of Afghanistan’s remaining polio cases are traceable to Pakistan.

Health officials say that was the probably the case with the girl in Kabul, whose name is Sakhina. Her family previously lived in Pakistan and her father is a taxi driver who travels frequently to the tribal areas. The specific strain of virus she contracted is known to be common there, they said.

In Pakistan, which recorded 93 new cases of polio last year, and in Nigeria, with 53 new cases, vaccination workers trying to eliminate the disease have been attacked by Islamic militants. That trend was particularly aggravated in Pakistan by the case of Dr. Shakil Afridi, who was convicted of treason after helping the C.I.A. find Osama bin Laden, using a vaccination campaign as his cover.