China’s health ministry has promised to provide medical care and a living allowance for an eight-year-old HIV-positive boy targeted by villagers for expulsion, state media have reported.

In a case that drew widespread condemnation, about 200 residents – including the child’s grandfather – signed a petition last week to expel him from their village in the south-western province of Sichuan to “protect villagers’ health”, triggering anger online at perceived prejudice and ignorance in the countryside.

Beijing has pledged to ensure the boy, nicknamed Kunkun by the media, receives an education after reports that he was being denied admission into local schools, the China Daily said on Monday.

The health ministry has also pledged to conduct spot checks around China to uncover any other violations of anti-discrimination policies, the state-run paper reported.

The provincial Communist party committee is investigating reports of the petition to expel the boy, the Global Times newspaper, with close ties to the party, quoted an unnamed propaganda official as saying.

The boy has been in his grandfather’s care since his parents left the impoverished village to seek work, the Beijing News indicated. It was unclear on Monday whether Kunkun still faced expulsion from the village.

Reactions on social media have been swift to condemn the villagers who signed the petition. “It’s terrible that the villagers are undereducated, they should be sent to school too,” said one user on Sina Weibo. Another commentator blamed Kunkun’s parents. “It’s strange that no one condemns the boy’s parents who are so irresponsible and can be charged with abandonment in foreign countries,” the user wrote.

The UN said it was deeply concerned about the case, which has prompted a huge debate in China and highlighted the stigma attached to the virus in a country.

“Stigma and discrimination are our biggest enemies in the fight to end HIV,” the UN said. “But sadly, this week’s reports demonstrate that breaching confidentiality, ignorance and fear continue to have devastating consequences for those living with HIV.”

The child’s grandfather, Luo Wenhui, told the Beijing News that he had signed the petition to remove Kunkun because he had “hoped it would make things better”, as the boy would receive better care elsewhere.

Luo, who is over 60, told the paper that he did not have long to live and the petition was suggested by a local journalist as a way of drawing attention to his grandson’s plight. “We are getting too old, and he is getting more naughty … we don’t have the ability to look after him,” he said. “If he didn’t live better outside the village, he could come back.”

The Global Times said the boy’s mother left the family in 2006, while his father lost contact after Kunkun’s condition was diagnosed.

The boy was reportedly referred to as a time bomb by villagers worried about being infected and local children shunned him. Reports said Kunkun was born HIV positive through transmission from his mother.

Kunkun told the Beijing News that he could not remember what his parents looked like, adding: “Other children don’t play with me.”