The Polish government announced the death. President Bronislaw Komorowski ordered flags on government buildings to be flown at half-staff.

Mr. Mazowiecki, a journalist by profession, worked quietly for years to ease restrictions on individual rights and helped form the Solidarity trade union movement, which gained the leadership of Poland's national legislature in August 1989. By the end of that year, the Berlin Wall had fallen, Communist governments in Moscow's other satellite states had collapsed and the Cold War division of Europe was over.

In a message of condolences, Chancellor Angela Merkel of Germany, who grew up in Communist East Germany, said that Mr. Mazowiecki made "an unforgotten contribution to overcoming authoritarian injustice and to the unity of Europe."

In the summer of 1980, a chain of labor disturbances rocked Poland. The focus was the Gdansk shipyard, where Lech Walesa led a strike to demand higher pay and the restitution of a fired worker. Mr. Mazowiecki (his full name is pronounced tah-DAY-oosh mah-zoh-VYET-skee) helped broaden it into an antibureaucratic social movement that became known as Solidarity.

He and his friend Bronislaw Geremek, a historian, persuaded 64 leading intellectuals, scholars, scientists and cultural figures to sign a petition that read in part: "In this struggle the place of the entire progressive intelligentsia is at their side. That is the Polish tradition, and that is the imperative of the hour."

Mr. Walesa thanked Mr. Mazowiecki and told him that he had a continued need for help from intellectuals in addressing government officials. Mr. Mazowiecki helped write the historic Aug. 31 agreement that ended the strike and established Solidarity by guaranteeing workers' rights to form independent trade unions with the right to strike.

The Communist government nonetheless felt threatened by Solidarity's mounting influence, and declared martial law on Dec. 13, 1981, making Solidarity and other pro-democracy groups illegal. As tanks rolled through Warsaw, Mr. Mazowiecki was arrested and imprisoned for more than a year. After his release, he was again one of Mr. Walesa's closest advisers.

The Polish economy worsened, and in 1988 Mr. Walesa and Mr. Mazowiecki coordinated a strike at the Gdansk shipyard. That strike brought no concessions. But a second, bigger strike brought the Communists to the negotiating table.

The Polish primate, Cardinal Jozef Glemp, appointed Mr. Mazowiecki a mediator, and he arranged the series of talks between the Communists and Solidarity that led to plans for quasi-free parliamentary elections in which a newly legal Solidarity would be allowed to participate.

In the June 1989 vote, Solidarity won overwhelmingly in the districts it was allowed to contest and, after parliamentary maneuvering with minor parties, was able to form a government. Gen. Wojciech Jaruzelski, head of the Communist government, asked Mr. Walesa for three candidates, of which he would select one as a Solidarity prime minister. He chose Mr. Mazowiecki. Many believed the Vatican influenced his choice, given Mr. Mazowiecki's role as an influential editor of Catholic weeklies and monthlies that promoted the social gospel underlying Solidarity's ideology.

Mr. Mazowiecki's V-for-victory sign to the chamber on appointment became the symbol of Poland's triumph over Communism.

The Communists retained control of the armed services, the police and the secret service, and Mr. Mazowiecki had to pledge to keep Poland in the Warsaw Pact, Moscow's military alliance. Still, he said in 2004, "I had this very strong conviction that we will make it, that we will be able to build the foundations for a democratic state."

He promised no "witch hunts" against the old government, saying it was "right and wise" to offer democracy to all Poles. When asked if he would be a Catholic prime minister or a prime minister of Solidarity, he replied: "Is there any contradiction between the two? I would like to reconcile the two."

At first, Mr. Mazowiecki told an interviewer, he was "terrified." With Poland facing staggering foreign debt, hyperinflation and a bankrupt treasury, he had reason to be. He had no choice but to accept harsh, unpopular conditions — including a wage freeze and an end to consumer subsidies — to secure a $700 million loan from the International Monetary Fund.

With no economic experience and little charisma, he was defeated when he ran for president in 1990. Mr. Walesa was elected.

Tadeusz Mazowiecki was born on April 18, 1927, in the city of Plock, in central Poland. His brother died in a Nazi concentration camp in World War II.

Mr. Mazowiecki studied law at the University of Warsaw but did not graduate. In 1953 he began editing a Catholic weekly, but was eventually fired because of his opposition to the Communist government. He started an organization of Catholic intellectuals and a new Catholic monthly.

In 1961 he was elected to the Polish Parliament, where he led the opposition to the Soviet invasion of Czechoslovakia in 1968 and unsuccessfully pushed for an investigation of the police massacre of striking Gdansk shipyard workers in 1971. As a result, he was barred from running for re-election in 1972. He then devoted himself to building alliances between the intelligentsia of the left and the fledgling Polish labor movement.

Mr. Mazowiecki, a tall, gaunt man with large, sad eyes, went on to hold various official and unofficial posts in Poland's government. In 1992 he was appointed envoy of the United Nations to war-torn Bosnia. He resigned in 1995 over what he regarded as the international community's insufficient response to atrocities there.

He was married twice; both wives died. He had three sons, Wojciech, Adam and Michal.