Mario Soares, a former prime minister and president of Portugal who helped steer his country towards democracy after a 1974 military coup and grew into a global statesman, has died aged 92.
Portugal's Socialist Party, which Mr Soares once led, said he died on Saturday.
He had been in hospital since December 13.
Mr Soares, a moderate Socialist, returned from 12 years of political exile after the so-called Carnation Revolution toppled Portugal's four-decade dictatorship.
He was elected prime minister and thwarted Communist Party attempts to bring Portugal under Soviet Union influence during the Cold War.
Mr Soares eventually helped guide his country from dictatorship to a place in the European Union.
In 1986, he became Portugal's first civilian president in 60 years and served two five-year terms.
Mr Soares's role as an international statesman was solidified through his work with the International Socialist movement.
As a vice president from 1976, he led diplomatic missions that sought to help resolve conflicts in the Middle East and Latin and Central America.
Mr Soares was visiting Palestinian leader Yasser Arafat in the Gaza Strip when Israeli prime minister Yitzhak Rabin was assassinated in Tel Aviv in 1995.
Both Mr Arafat and Mr Rabin were long-time friends of Mr Soares.
In 1986, Mr Soares became Portugal's first civilian president in 60 years. His broad popularity brought him two consecutive five-year terms.
During terms as prime minister and foreign minister, Mr Soares helped rehabilitate Portugal on the international stage after decades of isolation under the dictatorship established by Antonio Salazar in the 1930s.
Mr Soares's insistence on using the ballot box instead of weapons to end the dictatorship won him respect around the world.
He belonged to a generation of influential European Socialist leaders that also included his close friend Francois Mitterrand of France, Germany's Willy Brandt, Olof Palme in Sweden and Felipe Gonzalez in Spain.
The 1974 coup shot Lisbon to the centre of Cold War attentions as Portugal lurched to the political left after the dictatorship's fall.
Days after the Carnation Revolution - so named because people stuck red carnations in soldiers' rifle barrels - Mr Soares returned home by train from Paris to a rapturous welcome from crowds that flocked to meet him at Lisbon's Santa Apolonia train station.
The Communist Party's influence surged following the coup, prompting fears in the West that Portugal - a founding member of Nato - would come under the Soviet Union's influence and encourage other radical leftist movements in western Europe.
Mr Soares said that at an October 1974 meeting in Washington, then-US secretary of state Henry Kissinger told him he thought Portugal was doomed to communist rule.
But Frank Carlucci, the new US ambassador to Lisbon and later head of the CIA, argued that moderate democratic forces, especially Mr Soares's Socialists, would prevail. The 1976 election proved Mr Carlucci right.
Mr Soares, an affable figure and eloquent campaigner who led the Socialist Party, won the country's first entirely free elections and became prime minister.
Portugal had western Europe's last colonial empire, and Mr Soares was instrumental in quickly granting independence to Portugal's five colonies in Africa. Protracted wars had sapped the Portuguese economy and soured its relations with other western nations that had turned away from colonial rule years earlier.
Mr Soares was later criticised for cutting the colonies loose so abruptly. All of them - Angola, Mozambique, Guinea-Bissau, Cape Verde, and Sao Tome and Principe - became single-party Marxist states supported by the Soviet Union and Cuba after their independence. Angola and Mozambique drifted into civil wars as proxies in the Cold War struggle for influence in Africa.
Mr Soares held posts in a string of governments that lasted less than a year in the post-revolution political chaos. Banks were nationalised, spooking wealthy financiers who fled the country, and poor farmers seized the land they had long worked at large private estates.
Born in Lisbon in 1924, Mr Soares started out as a radical student organiser and became a renowned defence lawyer.
He was a relentless opponent of Salazar's regime, which along with Franco's roughly contemporary rule in neighbouring Spain, shut off the Iberian peninsula to outside influences. Salazar's secret police, known by the acronym PIDE, jailed Mr Soares 12 times and exiled him twice, once to the island of Sao Tome off West Africa.
After democracy, Mr Soares served four times as the country's foreign minister and three times as prime minister.
As prime minister in 1986 he ushered Portugal into the European Economic Community - later the European Union. That turned out to be a watershed year which placed the country on a fast-track modernisation programme.
Mr Soares capped his political career that year by becoming head of state. He rapidly set about keeping his campaign pledge to serve as "President of all the Portuguese" after years of division and unrest which brought eight governments between 1978 and 1985.
He was a fierce critic of the economic liberalism embraced by US president Ronald Reagan and British leader Margaret Thatcher which was alien to his Socialist convictions about the benefits of welfare capitalism.
As president, Mr Soares established a professional, if cool, relationship with centre-right Social Democratic prime minister Anibal Cavaco Silva, who admired Mrs Thatcher.
Though an unlikely team, Mr Soares and Cavaco Silva together oversaw the shedding of many left-inspired economic structures, such as the nationalisation of banks, adopted after the coup.
Opponents claimed Mr Soares had abandoned his Socialist ideals, but Mr Soares insisted his "cohabitation" with Cavaco Silva contributed to the country's newfound stability. He won a thumping re-election victory to serve a second five-year term in 1991.
Mr Soares then retired from politics to set up a cultural foundation. At the request of the United Nations, he became head of the Independent World Commission of the Oceans.
He also led a UN fact-finding mission on human rights to Algeria in 1998.
He returned to politics in 1999, winning a seat in the European parliament as the main candidate of the Socialist Party but then failing to be elected head of the assembly.
He also ran again for Portugal's presidency in 2006, at the age of 82. Younger voters had little grasp of his historic achievements and he finished third.
He is survived by two children and five grandchildren.