WARSAW, Poland (AP) — For Tadeusz Mazowiecki, his transformation from a pro-democracy writer and an intellectual to a moving force in Poland began in 1980, when he joined ranks with the striking workers at the Gdansk shipyard who founded the Solidarity movement.
Nine years later, he became the nation's first post-communist prime minister.
In both cases, he played an important role in Eastern Europe's historic democratic transformation.
Mazowiecki died on Monday at a hospital in Warsaw, where he had been taken several days earlier with a high fever, his personal secretary, Michal Prochwicz, told The Associated Press. He was 86.
Many called Mazowiecki's death a great loss.
Fighting back tears, President Bronislaw Komorowski said the Poles should think with gratitude about everything that has happened in Poland since 1989, when Mazowiecki took office.
National flags were flown at half-staff on government and administration buildings across Poland.
Lech Walesa, the former electrician who led the Solidarity movement, said it was a "pity that such great people are dying. We could have used his wisdom today, when democracy is not so perfect."
Prime Minister Donald Tusk said Mazowiecki was "an outstanding figure of Poland's politics of the 20th century" and that the Poles "remember his unusual calm, inner strength, very kind face and wise eyes. They gave us all courage."
In its message of condolences, the U.S. State Department said " the world has lost a true statesman; his legacy transformed Poland into a vanguard of democratic and free-market values."
A state funeral will be held Nov. 3 in Warsaw's Arch-Cathedral of St. John. Mazowiecki will be buried in the family grave in Laski, near Warsaw.
A lawyer by training, a writer and thinker by temperament, Mazowiecki was well equipped for his role in ousting communism from Poland and shaping a democracy.
As prime minister, he called for drawing a "thick line" to separate the communist past from new Poland, a variously interpreted and much-criticized comment that contributed to his ouster after more than a year in office.
The crucial 1980 Gdansk shipyard strike was held to demand restitution of a job for a fired worker, Anna Walentynowicz, better pay and a monument to workers killed during a 1970 protest.
The action rapidly grew into a massive wave of strikes that gave birth to Solidarity, Eastern Europe's first free-trade union and a nationwide freedom movement, led by Walesa, whose name quickly became known around the globe.
Walesa later said that "everybody was very glad" that Mazowiecki and other intellectuals joined workers, because it was a sign of united resistance.
Until well into Poland's democracy in the 1990s, Mazowiecki was among Walesa's closest counselors, advising him in the tough yet successful negotiations with the communists, who granted union and civic freedoms in 1980.
Like Walesa, and many Solidarity activists, he was detained under martial law, imposed on Dec. 13, 1981, to curb the freedom that had irritated Moscow.
After one year in confinement, Mazowiecki returned to Walesa's side and wrote reports about social and economic stagnation under martial law.
The hardships inspired a new wave of strikes in 1988. Mazowiecki walked arm in arm with Walesa at the head of angry workers in Gdansk. The renewed protests brought the communists to the negotiating table with Solidarity, to discuss the terms of democratization. Mazowiecki authored many of these terms.
The outcome was Eastern Europe's first partly free parliamentary election on June 4, 1989 that gave Solidarity seats in parliament and —hard to believe at the time — paved the way for the first democratic government in the cracking communist bloc.
In September, Mazowiecki became the region's first democratic prime minister. His V-for-victory sign to the chamber on appointment became the symbol of Poland's triumph over communism. Poland's peaceful revolution initiated changes in the region — climaxing in the fall of the Berlin Wall in November 1989.
On Monday, Poland's and foreign public figures praised Mazowiecki's achievements.
Poland's last communist leader, Gen. Wojciech Jaruzelski, who was president when Mazowiecki was prime minister in 1989-90, said he "appreciated Premier Mazowiecki's wisdom, moderation and presence of mind in assessing difficult situations, and his stubborn insistence on things that he considered to be key."
"He was prime minister at a very difficult time," Jaruzelski said. "It required a lot of wisdom and tact to lead Poland through the great reforms."
German Chancellor Angela Merkel, who grew up in communist East Germany, said that Mazowiecki made "an unforgotten contribution to overcoming authoritarian injustice and to the unity of Europe."
European Commission President Jose Manuel Barroso called him a "great Pole and European, one of the founding fathers of the new Poland and re-united Europe."
Mazowiecki started as a journalist for Catholic magazines in the late 1940s. A declared believer, he tried to reconcile ethics and religion with politics under the anti-church communist system, imposed on Poland as a result of World War II.
The 1970s marked Mazowiecki's growing involvement in independent, often clandestine think tanks that educated Poles toward democracy.
Usually serious and pensive, Mazowiecki showed a flash of humor during his policy speech in parliament, when he felt faint. Returning to the floor, he drew applause by saying that the stress and hard work had brought his condition down to the level of Poland's dilapidated economy.
His government was hastily composed of Solidarity backers, who were experts in their fields but had no government experience. They accomplished a milestone task: within months they laid foundations for a democratic state.
"I had this very strong conviction that we will make it, that we will be able to build the foundations of a new state on those ruins," Mazowiecki said in a 2004 interview.
The finance minister, Leszek Balcerowicz, gained universal respect for his unprecedented plan of stringent reforms that halted rampant inflation, made the local currency — the zloty — convertible, curbed central governance and paved the way for market economy. The painful effect was high unemployment from closed industries and state-run farms.
Mazowiecki also was accused of leniency for the communists, and many thought the "thick line" amounted to turning a blind eye to past evils. In retrospect, Mazowiecki believed his phrase was "right and wise" as it offered democracy to all Poles, regardless of political views, he told Teresa Toranska in a 2004 interview.
The price of the reforms was high. Mazowiecki unexpectedly lost in the 1990 first free presidential election to a complete unknown, a Polish emigre from Peru, Stan Tyminski. Walesa won in the runoff.
Former Solidarity activist and critic of today's Poland, Andrzej Gwiazda, said Monday that Mazowiecki is a "black figure in Poland's history" who "ruined Poland's economy and strengthened the power of the secret services."
In 1992, Mazowiecki was appointed the first U.N. envoy to war-torn Bosnia and widely reported on atrocities there.
Angered by a lack of international reaction to the killings, which he termed as war crimes, he resigned in 1995 after the fall of Srebrenica. Serb troops overran the city and killed some 8,000 Muslim men and boys, despite Srebrenica being declared by U.N. forces as a safe heaven.
Mazowiecki said at the time that his resignation was "all I can do for these people to tell the world, the Western and U.N. leaders that the situation cannot go on this way."
French Foreign Minister Laurent Fabius expressed his respect for Mazowiecki's "contribution to peace in the Balkans in mid-1990s."
He continued as lawmaker and politician in Poland and co-authored the 1997 Constitution and served as adviser to President Komorowski since 2010.
Mazowiecki was born April 18, 1927, in the central city of Plock to the deeply religious family of medical doctor, Bronislaw Mazowiecki. His father died in 1938.
Under the Nazi German occupation of Poland during World War II, in which 6 million Polish citizens were killed, teenage Mazowiecki worked as a messenger for the city hospital and for a trade company.
After the war, he studied law at the Warsaw University but did not obtain a degree, engaging instead in journalism and politics.
He was twice widowed. His first wife, Krystyna, died of tuberculosis within a year of their marriage. His second wife, Ewa, the mother of his sons Wojciech, Adam and Michal, died in 1970.