CARACAS (Reuters) - Hardline Venezuelan opposition leader Leopoldo Lopez was jailed on Thursday for nearly 14 years on charges of inciting 2014 anti-government protests that spiraled into violence killing more than 40 people.

Venezuelan opposition leader Leopoldo Lopez gets into a National Guard armored vehicle in Caracas in this February 18, 2014 file photo. REUTERS/Jorge Silva/Files

The ruling enraged foes of socialist President Nicolas Maduro who say Lopez is an innocent scapegoat, but it brought cheers from grassroots government supporters who view the U.S.-educated activist as a dangerous conspirator.

After a marathon session at the heavily guarded Palace of Justice, judge Susana Barreiros ruled Lopez, 44, who was arrested in February last year, had masterminded the violence and street riots that erupted for three months.

Though Lopez had publicly called for peaceful resistance to the Maduro government and was behind bars during most of the unrest, prosecutors said his speeches sent subliminal messages and constituted a call to violence.

He was ordered to return to the Ramo Verde military jail to serve a sentence of 13 years and nine months.

Lopez’s case has become a cause celebre for opposition supporters over what they deem the Maduro government’s trampling of human rights. The U.S. government, the United Nations and international rights groups had all called for Lopez’s release.

“This is not only an attack on liberty and legality ... but also a provocation to the Venezuelan people,” said Jesus Torrealba, leader of the opposition coalition which includes Lopez’s Popular Will party.

Some Lopez supporters banged pots and pans in upmarket areas of Caracas, a traditional form of protest in Venezuela. Others took to social media to vent their anger, hailing Lopez as a Venezuelan “Nelson Mandela.”

U.S. UNHAPPY

The sentence was a slap in the face for the United States, which had been pressing for his release during a quiet rapprochement with Venezuela over the last few months.

U.S. Assistant Secretary of State Roberta Jacobson said she was “deeply troubled” by the ruling.

Lopez has for years been one of the most prominent hardline figures in Venezuela’s opposition. He was a successful and popular mayor of the Chacao district of Caracas until 2008.

He is the scion of wealthy families and a direct descendant of the sister of Latin American independence hero Simon Bolivar as well as of Venezuela’s first president, Cristobal Mendoza.

That blue blood creates barriers with the poor, and his confrontational style puts off some moderate opposition figures.

A 2009 U.S. government cable revealed by WikiLeaks said that some in the opposition thought Lopez "arrogant, vindictive and power-hungry," though conceded his "enduring popularity, charisma and talent as an organizer." (goo.gl/o6E26R)

Lopez’s critics paint him as a dangerous radical in the pocket of Venezuela’s wealthy elite and the U.S. government.

They point to his attempts to unseat President Hugo Chavez in 2002. During a failed coup attempt, Lopez helped organize the illegal arrest of one of Chavez’s cabinet members.

Earlier in the day, Lopez supporters and government backers clashed outside the trial, with one opposition activist dying of a heart attack, according to Popular Will.

U.S.-based TV network Telemundo said freelance correspondent Daniel Garrido was attacked and had his equipment stolen.

Relatives of government supporters who died in the 2014 violence held a vigil outside the court on Thursday.

Slideshow (16 Images)

“Lopez caused many deaths,” said Delcy Diaz, 45, who works in a government-run welfare project.

Lopez’s team plans to appeal, and the ruling may bring protests against Maduro. But opposition leaders are trying to keep supporters focused on a December parliamentary election where polls show the ruling Socialist Party may fare badly due to Venezuela’s economic crisis.

“With elections in which they are poised to win, there is little appetite in the larger segment of the opposition for a renewed protest movement,” said Venezuela analyst David Smilde, a professor at Tulane University.