(CNN) Democratic presidential candidate Pete Buttigieg responded to a question about professional setbacks during Thursday's presidential debate by offering a candid reflection about struggling with his own sexuality and coming out as gay as an elected official in Indiana.

"You know, as a military officer serving under Don't Ask Don't Tell and as an elected official in the state of Indiana when Mike Pence was governor, at a certain point, when it came to professional setbacks, I had to acknowledge whether just being who I was, was going to be the ultimate career ending professional setback," Buttigieg said during the debate, which was hosted by ABC News. "I came back from the deployment and realized that you only get to live one life and I was not interested in not knowing what it was like to be in love any longer.

"So I just came out. I had no idea what kind of professional setback it would be especially because, inconveniently, it was a reelection year in my socially conservative community," he added. "What happened was when I trusted voters to judge me based on the job that I did for them, they decided to trust me and reelect me with 80% of the vote and what I learned was trust can be reciprocated and that part of how you can win and deserve to win is to know what's worth more to you than winning."

While being gay is not the entirety of Buttigieg's story -- or his campaign -- it's a key aspect of his identity and voters have said it sets him apart from the other candidates in the crowded Democratic primary.

Read More