Pete Buttigieg’s victory speech following the Iowa presidential caucus on 3 February was extraordinary for several reasons, not least because he had not won. “Iowa, you have shocked the nation,” the 38-year-old former small-town mayor told his Democratic supporters, speaking in a deep, measured cadence that evoked Barack Obama. He paused to take in the applause. “Because by all indications we are going into New Hampshire victorious.”

It was almost a week after the Iowa vote, which was beset by technical problems, before Buttigieg was declared the official winner by the Democratic state party. The results suggested that Buttigieg won with 14 delegates (and 26.2 per cent of the vote), placing him two delegates ahead, or 0.1 per cent ahead, of the left-wing populist Bernie Sanders, who at 78 is more than twice his age (Sanders’ team have demanded a “partial recanvass” of the vote). It represented a remarkable ascent for a self-described “Maltese-American left-handed Episcopalian gay war veteran mayor millennial” who was a year ago relatively unknown beyond South Bend, the fourth-largest city in the Midwestern state of Indiana, which first elected him mayor in 2011.

As the Democratic party agonises over whether it should tack left and embrace the radical policies of Sanders or Elizabeth Warren, or if its best hope of success lies with a centrist, Buttigieg is emerging as a strong candidate for the moderate wing. He could usurp its presumed frontrunner, former vice-president Joe Biden. Biden is also more than twice Buttigieg’s age (77) and looking wobbly – bumbling through TV debates with the vague expression of someone who has to focus too hard on remembering where he is or who he is talking to.

Buttigieg, who has a pale, boyish face with close-set grey eyes and a thatch of short dark hair, has a formal, wonkish manner that belies more combative political manoeuvres, such as his pre-emptive Iowa victory speech. A former management consultant and naval intelligence officer who speaks seven languages, Buttigieg often suggests he’s a “new kind of leader”, uniquely positioned to understand the novel challenges facing the US, from automation to cyberwarfare to climate change, and to transcend partisan divides.

The candidate launched his campaign by promising constitutional reforms, such as the abolition of the electoral college and the expansion of the US Supreme Court. More recently, Buttigieg has put forward diluted versions of some of Sanders and Warren’s plans: they pledge free college tuition, he’d grant it to families earning less than $100,000 (£76,000), they’d abolish private health insurance in favour of universal public coverage, he’d expand access to the government’s Medicare programme. He has an odd penchant for clunky catchphrases. He often speaks, for example, of reaching “future former Republicans” and has named his healthcare proposal “Medicare for all who want it”.

Buttigieg was born and raised in South Bend, where his parents worked as professors at Notre Dame, a Catholic university. An earnest, bookish teenager, he won a prestigious essay contest aged 18 for a piece of writing that praised Sanders’ political courage. He studied history and literature at Harvard, and politics, philosophy and economics as a Rhodes scholar at Oxford. In 2007, he followed a well-trodden path for gifted, unimaginative graduates by joining the management consultancy giant McKinsey.

As Buttigieg’s profile has risen, his McKinsey career has come under scrutiny. The firm has advised authoritarian governments, opioid manufacturers and ICE, the agency enforcing Donald Trump’s immigration crackdown. In December, Buttigieg relented to pressure to release his client list, which was relatively anodyne but did little to mollify those who see him as too corporate, out-of-touch or naively overconfident in his own ability.

In 2009, Buttigieg returned to South Bend and enlisted as a naval reserve. He left McKinsey the following year to run for Indiana’s state treasurer. He lost the election but built up his profile and network – when he stood for the mayoralty of South Bend aged 29, he won 74 per cent of the vote. Newsweek had recently listed the former industrial town of 100,000 people as one of America’s ten “dying” cities; Buttigieg launched an ambitious economic regeneration programme.

Buttigieg came out during his re-election campaign in 2015, writing an affecting op-ed for the South Bend Tribune describing how he struggled into adulthood to accept his sexuality, and expressing hope that he might ease the way for others in the conservative state. Indiana had recently passed legislation permitting businesses to discriminate against LGBTQ people on religious grounds. Buttigieg won the 2015 contest with 80 per cent of the vote.

That year he met Chasten Glezman, a drama teacher, via the dating app Hinge. The pair married in 2018. Chasten is charismatic and funny and has built up an impressive social media following, as have their two dogs, Truman and Buddy.

“Being mayor of your hometown is the best job in America,” Buttigieg wrote in 2016, though that hasn’t stopped him casting around for something better. He took a seven-month leave of absence to work as a naval intelligence officer in Afghanistan in 2014, and in 2017 unsuccessfully ran for chair of the Democratic National Convention. Then there’s his longshot presidential campaign, which launched in January 2019 and quickly garnered attention, in part because of his impressive fundraising. By April New York magazine featured him on its cover, smiling beatifically, with the strapline “how about Pete?” The following month he was on the cover of Time.

Buttigieg likes to invite comparisons with Obama, describing himself as a “young man with a funny name”. Both are intellectual, polished, unrufflable, but Obama was cool in both senses of the word: Obama’s the kid everyone wants to be; Buttigieg is the dork everyone’s mum wants them to be. He is considerably more popular among baby boomers than with young voters. It’s “as if he fell into a crevasse on his way to vote in the 2010 midterms and climbed out recently to find that his old friends had forgotten Panic! At the Disco and discovered socialism,” quipped one New York Times piece on “how the internet came to loathe Pete Buttigieg”. Recent articles in the leftist magazine Jacobin have described him as “objectively creepy”, “an annoying, entitled nerd” and “living proof that young people can be just as awful as old people”.

Buttigieg’s biggest vulnerability, however, is his dismal popularity among black and minority voters, who cite his mixed record in South Bend, including his dismissal of the town’s first African-American police chief, his poor handling of the police shooting of a black man in 2019 and the uneven effects of his gentrification projects. While Buttigieg’s momentum looks likely to continue through New Hampshire’s primary, the bigger test will be how he fares in the more diverse states such as North Carolina and Nevada. Could the millennial Midwestern mayor win the Democratic nomination and take on Trump? Unlikelier things have happened.