LJUBLJANA, Slovenia — A comedian who used to impersonate the former Slovenian prime minister will now get a chance to play the part for real.

Marjan Sarec, a veteran stand-up comic and actor, was appointed prime minister designate on Friday after his party finished second in Slovenia's parliamentary election.

Sarec, 40, who is expected to propose a minority government made up of five center-left parties, was chosen by a 55-31 vote in Parliament.

The country's leftist parties allied to sideline the top party in the June 3 parliamentary vote, the right-wing Slovenian Democratic Party led by former Prime Minister Janez Jansa.

"We are a new party, [a] new generation in politics that is not burdened with the past," Sarec told NBC News. "We are here to work."

But analysts have predicted that Sarec's minority government could be unstable — and probably would not last long.

Sarec, who had served as mayor of the small Slovenian town of Kamnik since 2010, rose to political prominence when he unexpectedly forced incumbent Borut Pahor to a second round of votes in the October presidential election.

But his roots are in comedy. He won fame as a popular impressionist who mimicked Jansa, mocking the former leader's apparent fondness for old Latin words and his shaky grasp of English.

Sarec was also well known for portraying a fictional character modeled on traditional peasants from northeastern Slovenia.

But he told NBC News that he will take his new role seriously. He said that is what he has done since he became a small-town mayor, when he made a "promise to conclude with the profession of actor."

"I kept this promise and assumed the position of a mayor with a great responsibility," Sarec said. "Today, I assume the function of the prime minister with a great responsibility towards all citizens."

Sarec also did stints as a volunteer firefighter and a journalist, working for the public broadcaster RTV Slovenia. He was among 571 journalists who signed a petition against censorship in 2005, during Jansa's tenure.

Jansa, an anti-immigration hardliner, has been compared to President Donald Trump, whose wife, Melania, was born in what is now Slovenia.

Sarec, for his part, said his own political views do not compare to those of the American president.

"Mine are different. I believe the definitions of being right or left are not important," he said. "It is much more important that we strive for an operational and effective government."