WARSAW (Reuters) - Poland's Deputy Prime Minister Waldemar Pawlak said he would resign from the government after unexpectedly losing a battle for the leadership of the junior coalition partner on Saturday, but there was no threat to the stability of the coalition.

Janusz Piechocinski, a 52-year-old member of parliament who beat Pawlak by 547 to 530 votes in the election at the PSL congress, said he wanted to keep the coalition with the Civic Platform (PO) intact.

Pawlak, who is also the economy minister in Prime Minister Donald Tusk's government, had led the PSL for seven years. Serving twice as a prime minister in the past two decades, he has been PSL's most prominent politician. He said he would hand his resignation to Tusk on Monday.

"PSL will be a rational coalition partner, a rational and wise participant of the parliamentary debate," Piechocinski told reporters after the vote, adding he wanted Pawlak to retain his position in government.

"Nothing that happened is a challenge to the government, to the coalition."

The party hit the headlines in July after media released recordings that showed suspected corruption among its party members. It led to the resignation of Agriculture Minister Marek Sawicki.

PSL members quoted by local media said Piechocinski won largely because of a campaign that targeted delegates from outside Warsaw and other larger cities.

(Reporting by Maciej Onoszko; Editing by Alison Williams)