CARACAS, Venezuela (AP) — Jailed Venezuelan opposition leader Leopoldo Lopez was convicted and sentenced Thursday to almost 14 years in prison, the maximum allowed, for inciting violence as leader of protests last year in which several dozen people died.

About 200 Lopez supporters gathered in a Caracas plaza expressed disbelief and sadness when they learned of the verdict, with several weeping and consoling each other with hugs.

Reflecting the passions stirred by the trial on both sides of Venezuela's deep political divide, an elderly man died and several people were injured during clashes earlier Thursday outside the courthouse between government loyalists and Lopez supporters.

The opposition leader has repeatedly denied the charges and says he only urged peaceful demonstration against President Nicolas Maduro's socialist government.

Supporters of the 44-year-old, Harvard-educated former mayor of a wealthy Caracas district say the trial was marred by irregularities. The court rejected all but two defense witnesses, both of whom ultimately declined to testify, while letting the prosecution call more than 100.

The trial was all but closed to the public, and Lopez sometimes refused to attend out of protest. His lawyers said Judge Susana Barreiros abruptly ended the proceedings last week even though many witnesses had yet to take the stand.

Combined with time served, the sentence of 13 years, 9 months, 7 days, and 12 hours was the maximum punishment for Lopez's crimes.

The prosecution focused on Lopez's public statements last year when, under the slogan "The Exit," he and other hardliners pushed for Maduro's resignation just months after pro-government candidates swept regional elections.

Prosecutors say the vitriolic rhetoric encouraged protesters to burn public property and put lives at risk. Officials also accuse him of conspiring with the United States and student demonstrators to try to overthrow the government.

U.S. officials deny that accusation and have made Lopez's release a key demand for normalizing diplomatic relations. Secretary of State John Kerry phoned Venezuela's foreign minister Tuesday to express concern about the trial days after meeting with Lopez's wife, Lilian Tintori, in Washington.

Roberta Jacobson, the State Department's top diplomat for Latin America, said in a tweet she was "deeply troubled" by the verdict and called on Venezuela's government to protect democracy and human rights.

Human rights groups immediately condemned the verdict, but government supporters blame Lopez for the bloodshed seen during last year's protests when more than 40 people were killed, both protesters and government supporters. At a rally outside the courthouse before the verdict was read, a band played folk songs with lyrics supporting a guilty verdict.

"Hold him responsible," went the chorus to one song.

Lopez, a father of two young children, has spent the past year and a half in a military prison outside Caracas where he'll now complete the sentence. With only his family allowed to visit, he managed to release several videos from behind bars.

In May, through a recording shot in his cell, Lopez called the largest rally Venezuela has seen since the wave of anti-government protests in 2014 that led to his jailing. In June he staged a 30-day hunger strike to demand the government schedule congressional elections.

Lopez's team accuses Maduro's government of wanting to sentence him now in hopes that any anger will fade before the vote is held Dec. 6.

Polls say Lopez continues to be one of Venezuela's most popular politicians with approval numbers approaching 50 percent, while Maduro's languish below 30 percent.

But the former triathlete is not universally liked by Venezuela's chronically divided opposition. Some leaders consider him too radical and out of touch with the poor masses who still revere Maduro's predecessor, the late Hugo Chavez.

Crime, inflation and shortages have only gotten worse since last year's protests, though many people have been hesitant to take to the streets again.

An opposition march called last month was downsized to a "planning meeting" when only a handful of people showed up.

Three co-defendants, all of whom had been freed before the verdict, received punishments of between 4 and 10 years by the judge on Thursday.