SEOUL, South Korea — Former President Kim Young-sam, who formally ended decades of military rule in South Korea and accepted a massive international bailout during the 1997-1998 Asian financial crisis, died Sunday. He was 87.

The chief of Seoul National University Hospital, Oh Byung-Hee, told a televised briefing that Kim died there early Sunday. He said Kim is believed to have suffered from a severe blood infection and acute heart failure before he died.

Kim was taken to the hospital on Thursday due to a high fever, Oh said.

South Korean President Kim Young-sam waves after arriving in Vancouver for the APEC Summit in this November 22, 1997 file photo. Kim died early on November 22, 2015 at the age of 87. © Gary Hershorn / Reuters / Reuters

Kim was an important figure in South Korea's pro-democracy movement and opposed the country's military dictators for decades. As president, Kim laid the foundation for a peaceful power transfer in a country that had been marked by military coups.

During his presidency from 1993-1998, he had his two predecessors indicted on mutiny and treason charges stemming from a coup. Still, Kim pardoned the two convicted military strongmen — Chun Doo-hwan and Roh Tae-woo — at the end of his term.

Kim also launched a popular anti-corruption campaign and vowed not to receive any political slush funds, though this was later tarnished when his son was arrested on charges of bribery and tax evasion.

He led South Korea in 1994 when the Clinton administration was considering attacking Nyongbyon — home to North Korea's nuclear complex — north of communist North Korea's capital, Pyongyang. Kim lobbied against the idea, fearing a possible war.

A U.S. aircraft carrier and a cruiser had been deployed near South Korea's east coast in preparation for a possible airstrike, and the United States planned to evacuate Americans, including its soldiers and their families, Kim said in a memoir.

A U.S. airstrike "will immediately prompt North Korea to open fire against major South Korean cities from the border," Kim said in his memoir, describing his dawn telephone conversation with President Bill Clinton in June 1994.

The crisis eased when former President Jimmy Carter met with the North's leader and founder Kim Il Sung, the grandfather of current ruler Kim Jong Un, in Pyongyang, which led to an accord aimed at freezing North Korea's plutonium-based nuclear programs.

That deal collapsed in 2002 when the United States accused North Korea of running a secret uranium-based program, sparking another nuclear crisis.

Kim was born into a rich fishing family on Dec. 20, 1927, in Geoge Island off the southeastern tip of the Korean peninsula when the country was still under Japanese colonial rule. During the Korean War, he anchored a defense ministry propaganda radio program.

A file picture taken on July 10, 1993 shows US President Bill Clinton, accompanied by his wife Hillary, shaking hands with S. Korean President Kim Young-Sam at the Blue House in Seoul. CHOO YOUN-KONG / AFP - Getty Images

In 1954, Kim was elected as the youngest member of the National Assembly. At that time, he was a member of the ruling party of the late Syngman Rhee, South Korea's first president.

But a few months later, he broke with the ruling party in protest over a constitutional revision and joined the opposition party, drawing anger from military rulers.

In 1979, Kim was expelled from the assembly for his anti-government activities, shortly before then President Park Chung-hee — who seized power in a military coup in 1961 — was assassinated by his intelligence chief.

During that chaotic period, Maj. Gen. Chun Doo-hwan and his military cronies rolled tanks and troops into Seoul to seize power in another coup that ended an interim government.

In the early 1980s, Kim was placed under house arrest twice and staged a 23-day hunger strike to protest political oppression.

Kim spent more than three decades in opposition as an advocate for democracy, though he later joined hands with military leader Roh Tae-woo and others to create a new ruling party.

In 1992, Kim became the head of the ruling party and was elected president, five years after his first unsuccessful presidential bid.

Kim is survived by his wife and two sons and three daughters.