A Hungarian Olympic gymnast-turned-mayor vaulted, barely, to another term in office despite a leaked video that captured him in a drug-fueled orgy aboard a yacht, according to reports.

Gyor Mayor Zsolt Borkai, a father of two who won a gold medal in pommel horse at the 1988 Summer Games in Seoul, was plunged into a sex scandal when the X-rated video emerged days before Sunday’s elections, according to the Mirror.

The footage — which also was posted on Pornhub, the world’s largest adult website — shows the randy 54-year-old horsing around with prostitutes surrounded by bottles of booze on the yacht off the coast of Croatia in the Adriatic Sea.

Since the video leaked, Borkai was forced to cancel public appearances amid claims he was being targeted in a smear campaign to oust him from office.

“I consider the lies published about me to be part of an opposition campaign aimed to divert attention away from their own incompetence,” he said, the news outlet reported.

But he later admitted he took part in the floating debauchery and refused to step down over “Borkai-gate,” as the sex saga has been described in local media.

Despite the electoral victory, Borkai faces potential retribution from Prime Minister Viktor Orban, an ally whose dominant right-wing Fidesz party suffered large losses in the local elections.

At least 10 of Hungary’s 23 largest cities, including the capital, Budapest, elected opposition candidates who had joined against the conservative prime minister’s populist brand of autocracy, according to the Washington Post.

An anonymous blogger calling himself “the Devil’s Advocate” posted links to the leaked footage — and accused Borkai and his lawyer of using government funds to fund their cocaine-fueled romp, the paper reported.

Meanwhile, a local left-wing news outlet reported that one of the scantily clad women who appeared in the sex tape had received almost $10,000 in government grants to open a wedding dress rental company with her sister.

“The published recordings picturing me were made years ago,” Borkai told a local TV station Oct. 7, according to Hungary Today. “Some of the footage is manipulated, other parts are genuine.”

He apologized for the tape, but refused to resign as he denied charges of money laundering, hiring escorts and using cocaine.

But now he’s widely expected to be booted from Fidesz, whose message of family values was sullied by the footage, in an effort at damage control, according to Bloomberg News.

As party chairman, Orban will make the final call.