Green Party Presidential candidate Jill Stein is defending Wikileaks founder Julian Assange, after an investigation found its leaks endangered gay men in Saudi Arabia.

Wikileaks is known for routinely publishing illicitly-obtained government data from around the world.

It faced criticism earlier this week after an Associated Press investigation of the 120,000 unredacted Saudi government files that Wikileaks dumped online in 2015.

The publication of the documents, which include health and crime records, exposed personal data of everyday Saudis, identifying at least one man with a gay sex conviction – as well as a number of rape victims and people living with HIV.

Saudi Arabia is one of the world’s most repressive countries when it comes to LGBT rights, raising fears of potential vigilante attacks against those identified.

Wikileaks has declined to deny the substance of the allegations.

In a statement, the organisation insisted it had not “disclosed ‘gays’ to the Saudi govt” – which no report actually accused them of doing – before claiming the story was “re-run” as the leak took place in 2015.

But amid the criticism, Green Presidential hopeful Jill Stein has rushed to the organisation’s defence.

She tweeted: “Unlike politicians, whistleblowers like WikiLeaks don’t feed us spin and deception. They invite us to read, watch and think for ourselves.

“I consider Julian Assange a hero because WikiLeaks shows us how institutions have been abusing their power and lying to the public.”

Assange, who has spent years hiding in London’s Ecuadorian Embassy amid rape allegations, recently threatened to leak more files to damage Presidential candidate Hillary Clinton, after Wikileaks publishing emails illegally hacked from the servers of the US Democratic National Convention. That attack was thought to have been perpetrated by Russian-backed hackers.

In an op-ed for The Hill, Dr Stein wrote: “One of the strangest developments this year has been seeing journalists attack WikiLeaks for doing what journalists are supposed to do: reveal the unvarnished truth to the public.

“WikiLeaks has done us an invaluable service by shining a light into the dark corners of power where corruption and wrongdoing fester.

“The economic and political elite have targeted Assange not because his hands are dirty, but because he’s given us a glimpse of how dirty their own hands are.

“WikiLeaks’ revelations are inspiring countless people to mobilize against corruption and wrongdoing at the highest levels, and for that, Julian Assange is a hero in my book.”