There is an anecdote everyone will have heard if they’ve spent enough time around people who used to work for the Labour party. It goes like this:

It was the last day of Labour conference in Brighton, at some point during the Blair and Brown years, and Barry Gardiner walked into a room full of aides. “Does anyone have toothpaste?”, he asked.

One of the advisers did, and handed him the tube. “Oh thank god,” he said, “I’d forgotten mine at home and I’ve been brushing my teeth with soap for three days.”

Beyond being obviously amusing, the story is, according to people who know him, “classic Barry”; though always nice enough, the man who has spent the past 16 years hovering around the Labour frontbench isn’t always aware of the world around him.

They were proved right last week, when a recording emerged of Gardiner rubbishing his party’s six Brexit tests as “bollocks” and calling the Good Friday Agreement “a shibboleth” in a private meeting in Brussels.

His skin was saved by Corbyn and the shadow secretary of state for international trade and energy and climate change will live to fight another day. But how exactly did he get here?

After all, Gardiner hardly is the stuff Corbynites are usually made of. Elected in 1997, the Brent North MP didn’t spend his formative parliamentary years objecting to the leadership from the backbenches.

He became a parliamentary under-secretary at the Northern Ireland office in 2004, held a similar post at the department of trade and industry a year later, then moved to environment, food and rural affairs.

This is where things get more complicated. When Gordon Brown got to power and purged his frontbench of those seen as too loyal to Blair, he made Gardiner his “special envoy for forestry.”

Depending on the Brownite you ask, the job was either “not seen as unimportant as we were coming up to the Copenhagen summit on climate change”, or “the kind of bullshit title you give someone you want to sack without pissing them off too much.”

In any case, he didn’t last in the job: after calling for Brown’s resignation and publicly attacking him for “vacillation, loss of international credibility and timorous political manoeuvres that the public cannot understand,” Gardiner was sacked in 2008.

Not one to stay down for too long, he reappeared on the frontbench in 2013 and hasn’t left it since.

“He was never really a Milibandite—he was an uber-Tony person,” said someone who worked alongside him between 2013 and 2015. Still, “he’d be one of those people who around reshuffles would really circle you, he’d get wind that there might be a reshuffle and he’d make sure he bumped into you.”

His time in Miliband’s team didn’t exactly convince his peers. “He is well known for being very pompous and not that good”, said one MP. “He’s a nice person; he’s jolly, he gets along with people, he’s thoughtful and he’s considered, but professionally he’s quite difficult.”

Unsurprisingly, his ability to rub people the wrong way nearly led him to his downfall. As parts of Britain were under water in February 2014, Gardiner, the shadow floods minister, was pictured by the Mail on Sunday swimming in a luxury resort in Mexico.

Labour legend has it that the story was leaked by Phil Taylor, a then-adviser to Gardiner’s boss Maria Eagle, who was about to defect to the Lib Dems anyway but delivered a parting gift to the shadow minister he could not stand.

Still, he stayed until the bitter end, and after the failed election, it did feel like things should have been over for him.

He even looked like he was getting ready for life outside the frontbench; in June 2015, he amused and baffled MPs by running for chair of the Environmental Audit Committee.

Instead of a leaflet, they were lobbied with a leaf, on which a LEAF piece of paper was taped: “Leave Environmental Audit For…Barry Gardiner.” He did not win.

It didn’t matter: three months later, he joined Jeremy Corbyn’s first shadow frontbench, as a junior minister in the energy and climate change team.

“When he latched his wagon to Jeremy, everyone was like ‘what the fuck?’ and it did sum up the fact that he’s just desperate to be on the frontbench and have a position of power,” said one former Labour staffer.

Cynical or not, the move work: following the mass resignations after the 2016 referendum, Gardiner finally got what he wanted—a spot in the shadow cabinet.

Now in charge of international trade, he became one of the most loyal Corbynites in the parliamentary Labour party, to the amusement of his colleagues.

“He’s made this transition into Corbyn whisperer”, an MP said, “he’s clung to Jeremy because he’s seen a way he can have a role that is disproportionately large compared to his abilities, and it’s his one chance to get it.”

And get it, he did: once one of the more obscure members of the Labour team, Gardiner became one of the main media performers during the general election last year, which gained him a loyal following among Corbyn supporters.

“LABOUR’S MEDIA-MAN ON FIRE HAS INTERVIEWERS FEELING THE BURN”, screamed a headline on blog the Skawkbox last year; “Labour’s Barry Gardiner pins down BBC bias so efficiently, the host has a meltdown,” announced a Canary headline.

Though Labour sources were keen to point out that he mostly appeared on-air this often because most shadow ministers thought the election would be a disaster and preferred to focus on their local campaigns, the conclusion was the same.

Now seen by the leader’s office as a reliable “shadow minister for the Today programme” as well as a trusted if unlikely ally, it seems unsurprising that Gardiner managed to get away with his Brexit gaffe. After all, there aren’t many long-time MPs Corbyn can count on, and he didn’t stay quiet for long, representing his leader on Question Time and Westminster Hour days after the scandal started to die down.

As for Gardiner, things couldn’t have gotten better. It might have taken over a decade of minor jobs, forests, backstabbing colleagues and puzzling campaigns, but the mild-mannered, slightly odd MP seems to have finally found his ideal political home, if not his natural one.