Image copyright AFP/Getty Images Image caption Viktor Orban (c) will be prime minister for a third time

Hungary's right-wing Prime Minister Viktor Orban has claimed a landslide victory in Sunday's general election.

The 54-year-old will serve a third consecutive term in office, with his party Fidesz projected to win a two-thirds majority in parliament.

Fidesz won almost half of the vote, with 93% of ballots counted, Hungary's National Election Office said.

Mr Orban is a strong Eurosceptic who campaigned on an anti-immigration platform.

In a speech to supporters on Sunday night, Mr Orban said his victory gave Hungarians "the opportunity to defend themselves and to defend Hungary".

Leaders of the second and third-placed parties have resigned in light of the result.

How did the result play out?

Polling stations were meant to close at 19:00 (17:00 GMT), but some stayed open hours later due to long queues. Voter turnout reached a near-record 69% - an outcome some believed would favour the prime minister's opponents.

But with almost all votes counted, the nationalist Jobbik party is in second place with 20% of the vote. The Socialists are in third with 12%, and the LMP, Hungary's main Green Party, is in fourth with 7%.

Jobbik's chairman Gabor Vona stood down on Sunday night, telling a news conference: "Jobbik's goal, to win the elections and force a change in government, was not achieved. Fidesz won. It won again."

Socialist Party President Gyula Molnar was similarly downcast as he resigned, saying: "We regard ourselves as responsible for what happened [and] we have acknowledged the decision of voters."

Orban keeps the provinces but loses the youth vote

By the BBC's Budapest Correspondent Nick Thorpe

As Fidesz paints the map of Hungary orange (their colour) once again, preliminary results show they will reach the 133 seats in the 199 seat Parliament needed for a constitutional two-thirds majority. They won two-thirds victories at both previous elections, in 2010 and 2014.

The prime minister's party won in most rural constituencies and in provincial towns, while opposition parties took most seats in the capital, Budapest.

Mr Orban's legitimacy on a European level will likely be strengthened, as nationalist parties across the continent take heart from his victory.

There were only two consolation prizes for anti-Fidesz voters: most constituencies in the capital, Budapest, went to opposition candidates. And Fidesz have also lost a large part of the youth vote. The next Fidesz government can be expected to include younger ministers, in an attempt to address this problem.

The result spells trouble ahead for civil society groups which campaign for human rights and against corruption, and for critical media. Viktor Orban has promised a "settling of accounts - moral, politically, and legally" with his opponents.

What are Orban's policies?

The election campaign was dominated by immigration, with Mr Orban promising to defend the country's borders and block migration by Muslims.

The prime minister refused to debate publicly with his opponents or speak to the independent media, speaking instead at rallies for his supporters.

These addresses focused on one core policy - stopping immigration.

"Migration is like rust that slowly but surely would consume Hungary," Mr Orban said at his final rally on Friday.

In 2015, Hungary built a fence along its borders with Serbia and Croatia to stop illegal migrants.

Image copyright AFP/Getty Image caption Mr Orban hammered home his anti-immigration stance at a number of campaign rallies

Mr Orban is an avowed Eurosceptic who opposes further EU integration. He refused to take part in the EU's refugee resettlement programme and has praised Russian leader Vladimir Putin.

Marine Le Pen, leader of France's National Front, tweeted Mr Orban her congratulations and said the "mass immigration promoted by the EU has been rejected once again".

Mr Orban has promised to cut income taxes and pass pro-growth economic policies.

His administration has presided over strong economic growth, which he had argued would be threatened under the opposition.