A consummate political survivor during his country’s shift from brutal communist regime to flawed democracy, he served three stints as prime minister.