* Judge said losses to public outweigh merits of injunction * Ban was part of suit seeking about $20 bln for oil spill * Chevron ban upheld except for spill mitigation, monitoring * Transocean ban still applies to Frade field RIO DE JANEIRO, Oct 1 (Reuters) - A Brazilian court overturned a ban on operations by offshore drilling contractor Transocean Ltd, accepting government arguments that the ban could cause billions of dollars in lost taxes for the government and output for the state-led oil firm Petrobras . Judge Felix Fischer, president of Brazil's second-highest court -- the STJ, agreed with arguments from Brazil's petroleum regulator, the ANP, according to a copy of the ruling obtained by Reuters. A ban on Transocean, the world's largest offshore drilling contractor, could deprive Brazil of 126 million barrels of oil, an amount equivalent to about two months of Brazilian output, the ANP said. It would also deprive the government of 6.71 billion reais ($3.31 billion) royalties over two years. If it had remained, the injunction would have shut down Transocean's 10 drilling rigs operating in Brazilian waters, eight of them under contract by Petrobras, as of Oct. 27. Transocean owns two of the three drilling rigs in Brazil that can drill in more than 2,200 feet of water. Such "ultra-deep-water" is where most of Brazil's most promising new reserves are located. Brazil is counting on tax revenues from those reserves to boost the economy and reduce poverty. "The reasons attached by the petitioner, rightly accompanied by technical data, exhaustively show that the economic damage is not restricted to the companies involved," Fischer wrote in his decision. The court, though, only eased a related ban on Chevron Corp's Brazil operations. The No. 2 U.S. oil company may continue only those activities related to the mitigation and monitoring of a 3,600 barrel November oil spill in the Frade offshore field northeast of Rio de Janeiro that led to the ban. Transocean shares rose 4.3 percent in New York, their biggest one-day jump in six days, after the ban was lifted. Petrobras preferred shares, the company's most-traded class of stock rose 1.4 percent in Sao Paulo, their first gain in three days. Chevron rose 1 percent in New York. A total ban on Chevron operations, the judge said, might prevent the company from continuing a cleanup, potentially harming the environment. Its activities will be monitored by Brazil's petroleum regulator, the ANP. "I authorize Chevron to maintain only mitigation and observations operations stemming from the accident in the Frade Field under the supervision and coordination of the ANP." Chevron says the leak from the field was controlled in November and that it shut operations at the field in March when unexplained traces of oil showed up in the same area. Chevron had contracted Transocean's Sedco 706 rig to drill in Frade, where the ban on Transocean remains in force. Chevron and Transocean say they were not negligent in the spill and are fighting the lawsuits and related criminal charges. The ANP said in a July report that Transocean had no responsibility for the spill and that while Chevron made errors in its drilling plan, failed to meet some safety requirements it and could have avoided the spill but that it was not negligent. The ANP fined Chevron $17.3 million, a fine which has been paid. The court document seen by Reuters is likely to be published early this week but was signed by Fischer on Friday. Brazil is in the early stages of developing its massive subsalt geological oil play, which could hold upward of 100 billion barrels of oil. A shortage of drilling rigs able to operate in waters more than 2,000 meters deep has restrained Petrobras' push to bring on this new oil despite a $237 billion five-year expansion plan. "The original injunction was groundless and targeted Transocean unfairly," a Transocean spokesman said. "The company and its employees were completely exonerated by ANP's investigation which concluded that the leak resulted from geological factors and was totally unrelated to the actions of the Transocean rig crew." Chevron and Petrobras officials did not immediately respond to requests for comment.