Hungary's ruling right-wing alliance lost its two-thirds majority in parliament after the opposition won a by-election on Sunday, hampering Prime Minister Viktor Orban's chances of changing the constitution and passing major legislation.

Orban's Fidesz - in alliance with the KDNP party - swept national, local and European Parliament elections last year but recent polls have shown a fall in support for Fidesz and gains by far-right Jobbik. The next election is in 2018.

Orban thanked supporters on his Facebook page and said the result was a warning that Fidesz “cannot sit on its laurels.”

Fidesz is grappling with infighting and a feud with a long-time ally, oligarch Lajos Simicska.

Orban's popularity has also suffered after a plan to tax Internet use, disputes with the United States and Norway over allegations of corruption and a crackdown on non-government organizations.

Hungary's friendly ties with Russia on energy have also caused alarm in some European capitals and in Washington, which all fret over the indebted central European country's perceived drift back into the orbit of its former Communist overlord.

“The situation and assessment of the ruling party is clearly worse than we would have thought over the past weeks,” political analyst Gabor Torok said on his Facebook page. “The party's candidate performed significantly worse than opinion polls would indicate. There may have been many right-wing voters who wanted to send a message by abstaining.”

Fidesz vice chairman Lajos Kosa put down the loss to the opposition framing the election as a chance to dismantle Orban's super-majority, which mobilized leftist voters more effectively.

An independent candidate supported by the leftist opposition, Zoltan Kesz, won 42.66 percent of the votes in the by-election in Veszprem in western Hungary. Fidesz candidate Lajos Nemedi got 33.64 percent.

The seat had become vacant after Tibor Navracsics, a former Fidesz deputy prime minister and foreign minister, was appointed European Commissioner last year.