(Adds protesters, false photos)
By Tomas Sarmiento and Andrew Cawthorne
CARACAS, Feb 19 (Reuters) - Imprisoned protest leader Leopoldo Lopez urged supporters to keep fighting for the departure of Venezuela's socialist government, even as he was due in court on Wednesday accused of fomenting unrest that has killed at least four people.
Lopez, a 42-year-old Harvard-educated economist, surrendered to troops on Tuesday after spearheading three weeks of often rowdy demonstrations around Venezuela that have turned into the biggest challenge yet to President Nicolas Maduro.
"Today more than ever, our cause has to be the exit of this government," Lopez said, sitting next to his wife in a pre-recorded video to be released if he was arrested. (http://t.co/uJGiXVm0AV)
"The exit from this disaster, the exit of this group of people who have kidnapped the future of Venezuelans is in your hands. Let's fight. I will be doing so."
Four people have died in the protests and the violence around them, three of them shot dead and another run over by a car during a demonstrations. There have been scores of arrests and injuries.
Many Caracas residents banged pots and pans overnight in a traditional form of protest.
Student demonstrators blocked a highway in Caracas on Wednesday morning, witnesses said. Also, police and protesters clashed in the western Andean city of San Antonio.
The demonstrators are calling for Maduro's resignation over issues ranging from inflation and violent crime to corruption and product shortages.
"We're sick of this. Leopoldo's decision to give himself up has simply shaken up the country more," student Maria Gabriela Guerrero, 24, said with a few dozen other demonstrators outside the Caracas court where Lopez was due to appear.
Maduro, who was narrowly elected last year to replace Hugo Chavez after his death from cancer, says Lopez and others in league with the U.S. government are seeking a coup against him.
Street protests were the backdrop to a short-lived ouster of Chavez for 36 hours in 2002, before military loyalists and supporters helped bring him back.
Though tens of thousands joined Lopez on the streets when he turned himself in on Tuesday, the protests so far have mainly been much smaller than the wave of demonstrations a decade ago.
There is no evidence the military, which was the decisive factor in the 2002 overthrow, may turn against Maduro now.
Lopez was being held on Wednesday at the Ramo Verde jail in Caracas, and was due at a first court hearing mid-morning.
Dozens of supporters stood outside the tribunal, holding banners saying "Free Leopoldo!" as a line of soldiers stood in front with riot shields and gas-cannisters. "We're prepared to give our lives," said pensioner Juan Marquez, 68.
In an intriguing twist to the drama, Maduro said his powerful Congress head Diosdado Cabello, seen by many Venezuelans as a potential rival to the president, personally negotiated Lopez's surrender via his parents.
Cabello even helped drive him to custody in his own car given the risks to Lopez's life from extremists, Maduro said.
Venezuela's highly traded and volatile bonds have seen prices fall to near 18-month lows on the unrest.
Yields are on average 15 percentage points higher than comparable U.S. Treasury bills, by far the highest borrowing cost of any emerging market nation.
"The heightened social unrest further undermines already fragile investor sentiment," said Siobhan Morden, Latin American strategy head for New York-based Jefferies.
With local TV providing minimal live coverage of the street unrest or opposition leaders' news conferences, Twitter, Instagram and Facebook have become the go-to media for many Venezuelans desperate for information on the crisis.
However, many social media users are indiscriminately Tweeting images without confirming their origin, leading to manipulation and gaffes including footage of unrest in Egypt and Chile being passed off as repression on the streets of Venezuela.
Old photos from past protests are also doing the rounds.
Detractors call Lopez a dangerous and self-serving hothead. He has frequently squabbled with fellow opposition leaders, and was involved in the 2002 coup, even helping arrest a minister.
"I've hardly been in office for 10 months and for 10 months this opposition has been plotting to kill me, topple me," Maduro said after his arrest.
"For how long is the right wing going to hurt the nation?"
Though the majority of demonstrators have been peaceful, a radical fringe have been tossing stones at police, blocking roads and vandalizing buildings.
Rights groups say the police response has been disproportional, with some detainees tortured.
The unrest has not affected the country's oil industry, which is struggling from under-investment and operational problems that have left output stagnant for nearly a decade.
Chavez purged state oil company PDVSA of its dissident leadership in 2003 after a two-month industry shutdown meant to force him to resign, making it unlikely workers could attempt something similar against Maduro.
In a nation split largely down the middle on political lines, 'Chavistas' have stayed loyal to Maduro despite unflattering comparisons with his famously charismatic predecessor. Many Venezuelans fear the loss of popular, oil-funded welfare programs should the socialists lose power. (Additional reporting by Deisy Buitrago in Caracas Javier Farias in Tachira; Editing by Brian Ellsworth and Chizu Nomiyama)