Polish freedom icon Lech Walesa issued an emotional video message on Sunday before going to hospital for surgery.
"I'm reporting to the hospital. What comes next, only time will tell," the 77-year-old Nobel peace laureate and former president said in a Facebook video.
"So, not knowing when we'll meet again or if we will at all, I'd like to say I did everything to serve the nation well.
"Till next time, if fate will allow me to stay on this Earth a little longer. If not, pray for me."
The former leader of the Solidarity labour movement that in 1989 brought a peaceful end to communism in Poland did not provide any medical specifics.
But his secretary Marek Kaczmar told AFP that Mr Walesa was in the hospital "regarding his pacemaker, a (planned) battery replacement".
"But there are complications. Some part of the wire that's in the heart is probably broken."
Mr Kaczmar said his boss, who later posted a photo of himself in a wheelchair, "got tests done, a chest X-ray, and is waiting for surgery tomorrow morning".
"We're optimistic ... The boss is strong. He's survived many a battle, so let's hope he'll make it out of this one stronger, too."
Working as a shipyard electrician in the Baltic port city of Gdansk, Mr Walesa stunned the communist bloc and the world when he led a 1980 strike by 17,000 shipyard workers.
The communist regime was forced to grudgingly recognise Solidarity as the Soviet bloc's first and only independent trade union after it gained millions of followers across Poland.
Mr Walesa won the Nobel Peace Prize for his leadership of Solidarity in 1983.
He later became Poland's first post-war democratically elected president in 1990.