Aktau, Kazakhstan ― I was the last person to board the rusting Soviet-era ferry to cross the Caspian Sea to Baku. Sultana Kali gave me one final hug. We’d been crying for days, as this chapter of my life drew to a close. Our final embrace was no different. I boarded and sobbed on the deck. Sultana, left behind on shore, kept watch and wept until the ferry was out of sight.

Failure.

That was my prevailing feeling as the coastline faded in the distance last month, marking the end of an exhilarating, and ultimately heartbreaking, tour as a diplomat in Kazakhstan.

It was exhilarating, in large part, because it began as the Obama administration called on its foreign service officers to champion lesbian, gay, and transgender rights abroad. As the first American diplomat to have come out as transgender on the job, I felt that I had much to offer, even in a deeply conservative, Muslim-majority nation like Kazakhstan.

It was heartbreaking, ultimately, because I walked away having managed to do little more than spark a glimmer of hope in a small community that came to see me as a beacon. It was particularly wrenching because earlier this year, one of my colleagues at the embassy dashed what I had hoped would be the lasting legacy of my tour: enabling Sultana, a young transgender woman, to get an American college education.

Openly transgender people in Kazakhstan are shut out of schools, universities, and all almost all lawful work.

Some history is in order before we get to that fateful moment on the visa line.

I arrived in Astana, the capital of Kazakhstan, in September 2014 as the regional officer monitoring environmental, science, technology, and health issues in the five post-Soviet countries in Central Asia. I accomplished a fair amount in this realm and enjoyed the work, but my day job was not what made Kazakhstan feel like home. It was the constellation of Kazakhstanis who gravitated toward me as I took on the unofficial role of American envoy to the country’s marginalized lesbian, gay, bisexual, and transgender community.

It began with a series of informal discussions I hosted at home. I later managed to steer small grants to civil society groups led by lesbian, gay, and transgender Kazakhstanis.

Openly transgender people in Kazakhstan are shut out of schools, universities, and all almost all lawful work. Getting personal identification documents changed to reflect a person’s new name and gender identity is virtually impossible. That made my story seem inconceivable to my new friends.

I came out under stressful circumstances in 2010 while serving in Romania. A letter written by a colleague disclosing the fact that I was transgender was making the rounds at the State Department, turning my lifelong struggle to reconcile how the world saw me and how I saw myself into the subject of workplace gossip and speculation.

When I told the embassy nurse in Romania that I was, in fact, transgender, I feared I would be marched out of the foreign service for conduct not appropriate for a diplomat. That, after all, was how several federal government careers came to a disgraceful end in the not-too-distant past.

As it happens, that was the initial bureaucratic instinct within my chain of command: to send me home to seek mental health treatment and make my personal struggle somebody else’s problem. But I had a stroke of incredible luck. A few months earlier, Hillary Clinton, then the Secretary of State, had instituted new anti-discrimination protections for transgender employees. These did more than save my job. I got to complete my assignment in Romania. I was the first State Department employee allowed to change my name and gender marker in our personnel system. And after returning home, I took the helm of the State Department’s lesbian, gay, bisexual and transgender employee group, a position that gave me significant visibility and clout.

Had I come out a few years later, I would have been more likely to become a pariah than a role model.

Robyn McCutcheon The author, pictured here with U.S. ambassador to Kazakhstan George A. Krol.

My lesbian, gay, and transgender friends in Kazakhstan were enthralled by my story. I was living and breathing proof that the world can and does change for the better ― sometimes stunningly fast. Being the face of this facet of America’s evolution toward a more just society was a true honor, one that more than made up for the darkest days of my journey, like the time I spent in a psychiatric ward in the early 1990s after telling family members that I was transgender. It also instilled in me a sense of purpose: how could I make the path easier for L.G.B.T. people who had no legal or community support to lean on?

I met Sultana in early 2016 at one of the dinners I hosted. I spotted her kneeling in front of my record collection.

“May I look at them?” she asked.

Of course, I replied. A few moments later she exclaimed: “You have Joni Mitchell! Could we listen to Joni Mitchell?”

I was hooked. There was something about this vivacious, young woman that compelled me to try to shape the trajectory of her life.

Sultana was expelled from high school in a provincial city in 2015 after she came out as transgender, when she was less than a year away from graduating. She was one of the most poised, well-spoken teenagers I had ever met. I asked her if she wanted to complete her education. Of course, she replied. I offered to help, assuming that as an American diplomat I would have the clout to get her enrolled in school.

I was naive. When I approached school and university officials to advocate on Sultana’s behalf, doors were politely but firmly slammed in my face. No one would own up to transphobia, of course. But my pleas fell on deaf ears, even at international schools and the elite Nazarbayev University, where officials told me that administrative rules prevented them from enrolling a transgender student. Perhaps, the admissions officer at Nazarbayev suggested, Sultana would be better off studying abroad. The director of an international school recommended trying a community college in the United States.

So that’s what we set out to do. Sultana moved into my apartment, as did her mother, who kept us fed through the frigid winter in Kazakhstan’s futuristic capital city. I got to know her family intimately. They were loving and supportive of their daughter, a rare blessing, given how transgender people are regarded in her part of the world. Sultana’s grandfather called me his second daughter. They all believed I could pull off a miracle.

Sultana and her mom weren’t my only guests. My apartment became a sorority house of sorts for young women in need of a safe haven. A college student took up residence in my guest bedroom. A nuclear physics graduate student whose father sometimes drank to excess laid claim to the couch in my living room for several months. There were a few others who stayed for shorter stretches. They became my family. Beyond a mentor, I became something more akin to an older sister or second mom to them.

Sultana and I spent last winter working on college applications. The dream of studying abroad filled her with hope and confidence. Sultana was among the Kazakhstanis featured in the United States embassy’s Human Rights Day video and introduced the American ambassador at an embassy-sponsored L.G.B.T. event. Soon, she became recognized as a fearless young feminist and L.G.B.T. activist.

Robyn McCutcheon Sultana speaks at the American embassy's event marking the annual International Day against Homophobia, Transphobia and Biphobia (IDAHOT). May 17, 2017.

The lack of a high school degree did not dissuade Lane Community College in Oregon from admitting her. School officials offered her a scholarship after reading the essay submitted with her application, titled “I Just Want to Live an Ordinary Life… and Create a Revolution.” It described Sultana’s desire to use her American education to fight for L.G.B.T. equality in her home country. Her only misgiving about studying abroad was how much she would miss her mom, her grandfather, her boyfriend, and her two cats.

With a college admission letter in hand, her visa application was something of an afterthought for us. Having once adjudicated visas myself, I had no reason to think Sultana’s application would raise red flags. Again I was wrong, but this time, it was about how things work in my own country these days.

The morning of her visa interview, I gave Sultana a warm hug and told her she had nothing to worry about. I had walked her through the process, which is fairly straightforward ― international students generate billions of dollars each year for American universities.

I came home to find Sultana curled in a fetal position on her bed. She’d been refused after the senior consular officer spoke to her for about three minutes. The officer told Sultana she didn’t appear to have enough money to make ends meet in the United States for four years.

This was a hurdle we could overcome, I assured Sultana. Nothing in the law says international students must demonstrate they have enough money to stay afloat for four years, but consular officers have vast discretion and are not required to explain their decisions in a detailed manner. Sultana submitted a second application. This time, besides the money her family had put forward, supporters who responded to an online crowdsourcing appeal contributed $10,000. Additionally, I filled out a document known as an attestation of support, committing to cover whatever expenses Sultana’s family could not.

Sultana went for a second visa interview in July. Refused again. The vice-consul didn’t even glance at the additional documentation. Not one to give up, Sultana tried a third time, this time after Senators Tammy Baldwin, Ben Cardin and Susan Collins, contacted by a number of Sultana’s supporters, had made inquiries on her behalf. Denied again.

I despaired, but there was nothing I could do internally. State Department rules forbid officials like me from intervening in visa cases. What, I wondered, had the consular officer seen in Sultana as she was standing across the window, handing over forms, bank statements, and her passport?

From my time adjudicating visas in Moscow years ago, I know that consular officers often suspect that young, beautiful women applying for visas intend to work as prostitutes. Could Sultana have sparked that suspicion? Additionally, she carries a passport that bears a male name and gender marker. Is it possible she got rejected because, as an openly transgender woman in Kazakhstan, she appeared to the consular officers to be an intending immigrant ― someone who intends to move permanently to the U.S.? Under the law, that finding would make her ineligible. Since I can’t ask directly, I may never know.

But I know this: Of 16 Kazakhstani students accepted by Lane Community College since 2010, Sultana is the first to be turned down for a visa.

Robyn McCutcheon View from the ferry as the lights of Aktau, Kazakhstan fade into the distance.

It pains me to think that this type of dream-crushing, arbitrary determination may be coming more naturally to my consular colleagues at a time when our president has set out to curtail travel by citizens of certain Muslim countries, calling them inherently dangerous, and has referred to transgender troops as a “burden” America cannot afford. And it pains me terribly that there is no avenue for redress or appeal.

I spent my last week in Kazakhstan trying to leave Sultana’s family with some hope. I gave them a medal the ambassador awarded me for service. And I promised I would not give up on finding a way to empower Sultana by giving her an education.

For now, it seems that delivering on that promise will require finding a third country that will see in Sultana the same sparkle and promise that drew me to her. That’s a devastating realization as I head to Washington to report for a new assignment, mindful of the profound political and societal shifts underway that have made my country feel less welcoming and tolerant. I will continue to serve faithfully, recognizing that the kind of progress that saved my life and career has never been linear.

But let’s not kid ourselves: For the foreseeable future, I will be serving the United States with a broken heart.

Robyn Alice McCutcheon received a Superior Honor Award from the State Department’s Bureau of South and Central Asian Affairs “for exceptional dedication and creativity in advancing LGBT rights in Kazakhstan.” In her next assignment she will be the senior watch officer in the State Department’s Nuclear Risk Reduction Center. Although Ms. McCutcheon is employed by the U.S. Department of State, the views expressed in the notes published here are strictly her own and do not necessarily represent the views of the Department of State or the U.S. Government.

Sultana Kali continues to speak her mind as an open activist. She appears in a recent Russian-language interview here.