It had all the elements of a classic coup: thousands descending on the capital, clashing with police outside parliament and commandeering state TV to demand the ouster of a civilian leader who had locked horns with the military in a country with a long history of turmoil and dictatorship.