(Corrects Villegas' previous title to planning minister from public works minister in ninth paragraph)
By Eduardo Garcia
LA PAZ, Feb 12 (Reuters) - A Bolivian judge ordered on Thursday the detention of a former head of state energy company YPFB, Santos Ramirez, who has been charged with corruption in a scandal that has prompted the government to fire dozens of company workers.
Leftist President Evo Morales fired Ramirez last month as police launched an investigation into accusations he solicited a bribe in 2008 to grant an $86 million contract to Argentine-Bolivian company Catler Uniservice to build a natural gas plant.
"(The judge) ordered the preventive detention of former YPFB president Santos Ramirez ... in the San Pedro jail, in La Paz," state-run news agency ABI said on Thursday.
Ramirez has been in custody since Tuesday, but the public prosecutor's office requested his temporary detention because they feared he could try to derail the investigation if released.
He has been formally accused of several crimes, including soliciting a bribe and financial mismanagement.
Meanwhile, the new head of YPFB, Carlos Villegas, sacked 74 workers from the company's headquarters on Thursday, accusing some of them of corruption. He said others had to go because the company was overstaffed.
A YPFB spokesperson told Reuters that the company's head office in La Paz employs some 250 people.
"The number of employees has increased dramatically, and without reason," said the spokesperson, who asked not to be named.
Villegas has worked as energy minister and planning minister and became the sixth head of YPFB in three years late last month pledging to fight corruption.
Police began investigating Ramirez when Catler manager Jorge O'Connor was killed and robbed of $450,000 in cash that allegedly was going to be handed over to a Ramirez aide.
Morales nationalized Bolivia's natural gas industry soon after taking office three years ago and put YPFB in charge of managing the country's biggest industry.
YPFB runs a number of energy companies that were in the hands of foreign investors until recently, including the only two oil refineries in Bolivia and the largest pipeline company.
But YPFB has not delivered on promises to invest heavily to increase the country's natural gas production capacity and has struggled to tackle fuel shortages in the Andean country.
The company had pledged to invest $1 billion this year.
Ramirez, a leading figure in the ruling Movement Toward Socialism party, was head of the Senate from 2006 to 2007 and was one of the architects of the energy nationalization.
Bolivia has the second-largest natural gas reserves in South America after Venezuela and is the region's largest exporter of the fuel.
The impoverished country exported over $3 billion worth of natural gas to Argentina and Brazil in 2009.
Editing by Eric Beech