ASUNCION, Paraguay – Paraguay’s Senate removed President Fernando Lugo from office in a rapid impeachment trial Friday, and the leftist former priest said he was stepping aside even though he considered his ouster a blow to democracy.

Vice President Federico Franco was promptly sworn in as president after tense hours during which Lugo’s supporters massed in the streets, facing off with riot police. The outgoing president, who was elected on pledges of helping the poor, averted the potential for a bigger conflict by saying he would comply with the Senate’s vote.

“I say goodbye as president,” a smiling Lugo said shortly after the Senate vote. He said, however, that Paraguay’s democracy “has been deeply wounded.”

Franco, who had split ways with Lugo in recent years, declared: “At this time, God and destiny wanted me to assume the presidency.”

The Senate tried Lugo on five charges of malfeasance in office, including an alleged role in a deadly confrontation between police and landless farmers that left 17 dead.

After the five-hour trial, 39 senators dismissed Lugo, four voted against and two were absent.

Lugo’s removal after nearly four years in office highlighted his inability to find a balance with one-time allies who increasingly disapproved of his leftist policies and strident style.