RIO DE JANEIRO — A Brazilian court has ordered 17 employees from two American companies, the oil giant Chevron and the rig operator Transocean, to surrender their passports, barring them from leaving Brazil as authorities prepare to file criminal charges in days in connection with an offshore oil spill involving the companies.

The ruling by Judge Vlamir Costa Magalhães, issued late Friday night, adds to Chevron’s woes in Brazil, which began last November when oil was found to be leaking from an offshore field controlled by Chevron. Prosecutors have already filed a civil lawsuit seeking damages of 20 billion reais, or about $11.2 billion, from the company.

Brazil’s Navy and Chevron said Friday that they had detected a new oil sheen from the field where the earlier spill occurred.

Chevron’s legal battle here points to the risk involved in Brazil’s plans to tap its huge offshore oil fields. If Brazil meets its ambitious production targets, by the 2020s, it could join the largest oil producers, with output rivaling or surpassing traditional oil powers like Iran and Venezuela.