From 2010 to 2018, the number of H.I.V.-positive people in Pakistan nearly doubled, to about 160,000, according to estimates by UNAIDS, the United Nations task force that specializes in H.I.V. and AIDS. During that time, the number of new infections jumped 38 percent in those 15 to 24.

The real number is likely higher; much of the population goes untested, while only about 10 percent of people thought to be H.I.V.-positive are being treated.

The country spends very little on its efforts to counter H.I.V. and AIDS and is nearly entirely dependent on support from other countries for its programs, whether for funding to staff testing centers or to provide retroviral drugs to counter the virus.

“With competing priorities, H.I.V. and AIDS is at the back seat of the government’s agenda,” said Maria Elena Filio-Borromeo, the UNAIDS director for Pakistan and Afghanistan.

Since 2003, there have been eight H.I.V. outbreaks in Pakistan. And Ratodero had been the site of one before: In 2016, an outbreak hit some 1,500 adult men who had engaged in sex with infected prostitutes, officials said.

But this year’s outbreak in Ratodero is the first time that children have been the most frequent victims on such a large scale, Ms. Filio-Borromeo said.

To counter the outbreak, the Pakistani authorities in May began shutting down the clinics of unqualified doctors and illegal blood banks — many of which were found to be reusing syringes. Months later, however, some of those clinics had since reopened, locals say.