Frida Ghitis, a former CNN producer and correspondent, is a world affairs columnist. She is a frequent opinion contributor to CNN and The Washington Post and a columnist for World Politics Review. The opinions expressed in this commentary are those of the author; view more opinion articles on CNN.

(CNN) The United States has long played a decisive role in the global struggle against prejudice and discrimination. That's particularly true in the battle against homophobia, which continues to destroy lives in many countries . So, it came as a harsh blow this month when US embassies around the world received instructions from their bosses in Washington not to raise a rainbow flag -- a symbol of gay rights -- on the "public-facing flagpole" during this month's LGBT Pride celebrations.

The flag might fly elsewhere, perhaps in an inner embassy courtyard, as if the US were embarrassed to stand up for equal rights.

The move is not just a casual, unimportant one. In scores of countries today , gays, lesbians and transgender people, and others who some may perceive as such, live in fear for their lives. The support from the most powerful nation on Earth provided solace, encouragement, and tacit protection.

But under President Donald Trump, the US government's position on the issue is a muddle of contradictions and disappointment.

Trump vowed to become a champion of gay rights during his convention speech in 2016. "As your president," he declared, "I will do everything in my power to protect our LGBTQ citizens from the violence and oppression of a hateful foreign ideology." Once in the White House, however, he has shown his word is not his bond.

At the same time, and perhaps confusingly to some, Trump has made some high-profile statements in favor of gay rights.

On May 31, he tweeted , "As we celebrate LGBT Pride Month and recognize the outstanding contributions LGBT people have made to our great Nation, let us also stand in solidarity with the many LGBT people who live in dozens of countries worldwide that punish, imprison, or even execute individuals.... on the basis of their sexual orientation."

And he noted that his administration has launched a campaign to decriminalize homosexuality around the world.

Confused?

Is Trump homophobic or isn't he? Is the US' foreign policy to fight anti-gay laws around the world or isn't it?

What's likely happening here, as with so many other policy issues, is that Trump -- and his administration -- are doing what they think is best for him politically, regardless of the consequences for other people or for the country.

And, in a familiar pattern, the views of Trump's most ardent supporters seem to matter more than what is morally right, or what is advantageous for America. The decision to stop flying the rainbow flag was likely greeted with cheers by many in Trump's base. Prominent evangelist Franklin Graham, explained , "The gay pride flag is offensive to Christians ..." (apparently more offensive to Graham, a Trump supporter, than allegations that Trump had an affair with a porn actress while his wife was caring for their newborn son, or boasting of "grabbing" women; Trump has denied an affair with Stormy Daniels).

But the decision to please the far right may backfire for Trump. Support for gay rights is widespread. According to Gallup poll data, only about 1 in 4 Americans say same-sex relations should be illegal.

That's a big change even from 2011, when Secretary of State Hillary Clinton told the United Nations Human Rights Council , "Some have suggested that gay rights and human rights are separate and distinct, but, in fact, they are one and the same."

That year, President Barack Obama issued a memo instructing all US agencies engaged abroad to "promote and protect the human rights of LGBT persons." The US aimed to make supporting LGBTQ rights around the world an integral element of its foreign policy. Now, the Trump administration has even shut down the website that provided key information on the subject.

Stay up to date... Sign up for our new newsletter. Join us on Twitter and Facebook

That's desperately depressing news for people in countries where you can still be sentenced to death for being gay, or where you can go to prison for belonging to a gay organization. As recently as January, for example, a gay man was executed in Iran for violating the nation's anti-gay laws. The possibility of attacking Iran on its homophobia, incidentally, could be the reason behind the White House's global campaign for decriminalization.

But when it comes to LGBTQ rights anywhere else, Trump is seemingly more interested in exciting the support of evangelical preachers than in keeping his word to the American people and America's pledge to be a champion against discrimination around the world.