The United Nations' human rights chief has warned of the "dark clouds" of political extremism and intolerance that are building over Indonesia.
Zeid Ra'ad al-Hussein has highlighted the blasphemy laws that were used to imprison Jakarta's governor last year, and planned new legislation that will criminalise gay sex.
"If Muslim societies expect others to fight against Islamophobia, we should be prepared to end discrimination at home too," said Mr al-Hussein, who is Muslim.
Indonesian politicians and religious organisations regularly attack the nation's LGBT community and all the nation's major political parties have agreed on a new draft criminal code that will enable authorities to jail gay people as well as unmarried couples who have sex.
He said the debate about the laws "betray strains of intolerance seemingly alien to Indonesian culture that have made inroads here," Mr al-Hussein said.
"The extremist views playing out in the political arena are deeply worrying, accompanied as they are by rising levels of incitement to discrimination, hatred or violence in various parts of the country, including Aceh."
Last week the police chief of North Aceh province led raids on transgender beauty salons and supervised the shaving of the trans women's hair in front of a laughing mob.
Last year in Aceh, two gay men were publicly caned after neighbourhood vigilantes burst into their home to catch them together.
Mr al-Hussein said Indonesia's LGBT people already faced threats and intimidation.
He said the "hateful rhetoric against this community that is being cultivated seemingly for cynical political purposes will only deepen their suffering and create unnecessary divisions".
During his visit to Jakarta, he even addressed Indonesia's darkest period: the anti-communist massacres of 1965 that accompanied the rise of Suharto to president.
"As one senior official told me, Indonesia is still stuck in 1965 — unable to reckon with the terrible events that took place then, including the killings of at least 500,000 people accused of being communists," Mr al-Hussein said.
President Joko Widodo promised to address Indonesia's past human rights violations during his time in power — but there's very little movement and even modest efforts to discuss 1965 have been resisted by extremist protests.
Mr al-Hussein also spoke of malnutrition in Papua and human rights violations against farmers and environmentalists who are standing up to mining and logging companies.
He said that in many ways Indonesia is living up to its great promise in "transforming itself into a vibrant democracy".
"There are some dark clouds on the horizon but I am encouraged by the positive momentum and hope the common sense and strong tradition of tolerance of the Indonesian people will prevail over populism and political opportunism," Mr al-Hussein said.