WARSAW — Tadeusz Mazowiecki’s transformation from a prodemocracy 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 postcommunist prime minister.
In both cases, he played an important role in Eastern Europe’s historic democratic transformation.
Mr. Mazowiecki died on Monday at a Warsaw hospital, where he had been taken several days earlier with a high fever, his personal secretary, Michal Prochwicz, said. He was 86.
Fighting back tears, President Bronislaw Komorowski said the Poles should think with gratitude about everything that has happened in Poland since 1989, when Mr. Mazowiecki took office.
A lawyer by training, a writer and thinker by temperament, Mr. 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 the 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 Lech Walesa, whose name quickly became known around the globe.
Walesa later said that ‘‘everybody was very glad’’ that Mr. Mazowiecki and other intellectuals joined workers, because it was a sign of united resistance.
Until well into Poland’s democracy in the 1990s, Mr. 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, Mr. 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. Mr. 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. Mr. Mazowiecki authored many of these terms.
The outcome was Eastern Europe’s first partly free parliamentary election on June 4, 1989, which gave Solidarity seats in Parliament and paved the way for the first democratic government in the cracking communist bloc.
In September, Mr. 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.
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.
The finance minister, Leszek Balcerowicz, planned 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.
Mr. 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, Mr. Mazowiecki believed his phrase was ‘‘right and wise’’ as it offered democracy to all Poles, regardless of political views, he said in 2004.
The price of the reforms was high. Mr. 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.
In 1992, Mr. Mazowiecki was appointed the first UN envoy to war-torn Bosnia and reported on atrocities there.