WAKISO, Uganda — Some menstruating schoolgirls were locked in dormitories while their peers were in class. To avoid the humiliation, others stayed home.

As more girls skipped class because they couldn’t afford sanitary pads, authorities at a government-backed school outside Uganda’s capital, Kampala, were forced to do what few have done: provide free sanitary pads.

“We looked at the absenteeism rate and you would find that in a class if there are six people who are absent, at least four of them are girls. Some boldly came to us and said, ‘When we are on our period there is no care, so that’s why we prefer staying at home,'” said Vincent Odoi, a teacher at Wampewo Ntakke Secondary School.

Menstrual hygiene has emerged as a serious, and often emotional, subject in Africa, where some experts say governments must supply free sanitary pads to schoolgirls who often are at risk of dropping out because of embarrassment.

The issue recently became politically charged in Uganda when a prominent academic was jailed for calling President Yoweri Museveni “a pair of buttocks” after the government broke a promise to provide free sanitary pads to schoolgirls across the country.

One in 10 African schoolgirls misses school during menstruation, according to the United Nations, and many, after lagging behind, eventually drop out.

Last month, Kenya’s President Uhuru Kenyatta signed a law authorizing his government to supply sanitary pads to teenage girls at public schools nationwide. Zambia announced a similar plan in 2016 targeting schoolgirls in rural and semi-rural areas.

But elsewhere in Africa, appeals for free sanitary pads have not been so successful.

Stella Nyanzi, a research fellow at Uganda’s Makerere University, faces criminal charges after she accused the country’s first family of being out of touch with ordinary people when the government said it couldn’t afford to donate sanitary pads.

“Girls and young women are not going to stop menstruating in the near or far-off future,” Nyanzi’s campaign, dubbed #Pads4GirlsUg, told reporters after she was released from jail in May. The campaign has raised nearly $10,000, and Nyanzi visits schools where she distributes the pads amid boisterous song and dance.

About 34 percent of Uganda’s population lives below the poverty line on less than $2 per day, according to World Bank figures. Much of sub-Saharan Africa faces similar levels of poverty, or worse.

At Wampewo Ntakke Secondary School outside Kampala, authorities once confined menstruating girls to dormitories because there was no running water and some girls, lacking sanitary pads, stank in class. But there was another problem: imported sanitary pads were rapidly filling up the latrines, imposing new costs for frequently emptying them.

In the end, the school’s board decided in 2013 that it would be wiser to provide locally made, biodegradable sanitary pads to all schoolgirls. The move has all but ended absenteeism tied to sanitary hygiene, said Odoi, who oversees the program.

“It’s something we put in our budget, just like any other expenses like electricity, water and others,” he said. “We said, ‘Let’s provide for a certain amount of money to cater for this,’ and it has worked. We have not seen that expenditure entering so deep in our pockets. It can be done.”

The school spends about $1,000 on sanitary pads for each three-month academic term.

Student Patricia Mukashema said the school’s generosity helped families who couldn’t afford the pads. “Now we don’t put that pressure on our parents,” she said.

Another student, Patience Atim, said she was touched by news reports of schoolgirls in rural Uganda who cite “too much suffering” when they use crude substitutes for pads.

“They will use bedsheets, fibers,” she said.

The pad given out at the school is known as Makapad, the product of a Ugandan academic who created it with the backing of the Rockefeller Foundation. The pads — made from waste paper and with papyrus as the absorbent — sell for half the price of imported pads, yet there isn’t widespread demand for them, said inventor Moses Musaazi.

Sixty-three cents — or 2,300 Uganda shillings — for a pack of 10 Makapads is still a lot of money for some Ugandans, Musaazi said.

“It’s a mindset of poverty. When somebody is poor, you wouldn’t want to spend a shilling, even if it is on a vital component of their life. What they think is essential is not a sanitary pad.”

Since 2005, when Makapads were unveiled, most have been bought by the U.N. refugee agency in Uganda, said Juliet Nakibuule, who runs Technology for Tomorrow, a local company that distributes them.

Odoi, the school official, said he has come to think of sanitary pads as essential for schoolgirls’ well-being, as important as food and drink.

“If other head teachers can follow the same example and give out free pads, I think it will be very good for this country,” he said.