SEOUL, South Korea — Kim Young-sam, the former president of South Korea who replaced the last of the country’s military leaders, purged politicized generals and introduced a landmark reform aimed at transparency in financial transactions, died on Sunday in Seoul. He was 87.

The cause was sepsis and heart failure, said Oh Byung-hee, the chief of Seoul National University Hospital, where Mr. Kim was admitted with a fever on Friday. He had been treated for a series of strokes and pneumonia in recent years.

Mr. Kim, an outspoken critic of military dictators from the 1960s through the 1980s, was president from 1993 to 1998.

He was one of the “three Kims” — the others were former President Kim Dae-jung and former Prime Minister Kim Jong-pil — who played major roles during South Korea’s turbulent transition from dictatorship to democracy.