Polish Prime Minister Beata Szydło | Stephanie Lecocq/EPA | Stephanie Lecocq/EPA Polish PM Beata Szydło resigns Mateusz Morawiecki, formerly an economic adviser in the cabinet of Donald Tusk, will become prime minister.

WARSAW — Polish Prime Minister Beata Szydło submitted her resignation to the Law and Justice (PiS) party leadership Thursday.

PiS leaders decided to replace her with one of her deputies — the minister of finance and economic development, Mateusz Morawiecki — party spokesperson Beata Mazurek told reporters.

“Prime Minister Beata Szydło submitted her resignation to the political committee of the party,” Mazurek said outside PiS headquarters in Warsaw. “The political committee proposed deputy prime minister Mateusz Morawiecki as a candidate to become the prime minister.”

On Thursday morning, Szydło easily won a no-confidence vote brought by the opposition, only to be told by her own party to submit her resignation. Party leader Jarosław Kaczyński kissed her arm and cheeks and handed her a large bunch of flowers in the chamber after the vote but eight hours later the party leadership, convened by him, decided it was time for her departure.

Mazurek said Szydło would be offered a job in the new government of Morawiecki but refused to give more details. The head of the PiS group in the parliament, Ryszard Terlecki, told reporters earlier in the day that a new Cabinet would be in place next week. The PAP news agency said the new Cabinet will be voted in on Tuesday, with no change of ministers at this point.

Morawiecki, 49, is a former banker who speaks fluent English and German, and would be a smoother partner for other EU leaders than Szydło. From 2010 to 2014 he was an economic adviser to then prime minister Donald Tusk, whom staunch PiS supporters consider an enemy.

Kaczyński has reportedly been mulling Szydło's removal from power since a party meeting on Monday evening.

Kaczyński chose Szydlo to be the face of his party in 2015. While the 54-year-old prime minister was popular at home, her administration has been involved in clashes with Brussels over rule of law and migration.

Sydło sent a tweet Tuesday while rumors were swirling about her impending departure, saying: “Whatever happens, Poland is most important.”

Ginger Hervey contributed to this article.