Image copyright Reuters Image caption Demonstrators take part in an anti-Tesla protest in Germany

Tesla has been ordered to temporarily halt preparations for a car factory in Germany after environmentalists won a court injunction on Sunday.

The electric carmaker had been clearing forest land near the capital, Berlin, ahead of building its first European car and battery plant.

The court emphasised the injunction was temporary and subject to further hearings, probably this week.

Protesters say the factory is a threat to local wildlife and water supplies.

To much fanfare, Tesla's boss Elon Musk announced plans last November to build a European facility known as a "gigafactory" in Grünheide, in the eastern state of Brandenburg.

But the factory has become a flashpoint between environmentalists and Germany's pro-business Christian Democrat and Free Democrat parties, who fear the issue could damage the country's image as a place to do business.

The dispute highlights the risks for the US carmaker, which has not been officially granted permission to build the factory. Tesla was, however, granted permission by Germany's environment ministry to begin site preparations "at its own risk".

This has involved clearing about 91 hectares (225 acres) of forest and the felling of thousands of trees - something that outraged an alliance of environmentalists called the Green League.

In a statement on Sunday, the court representing the Berlin and Brandenburg region cautioned: "It should not be assumed that the motion seeking legal protection brought by the Green League lacks any chance of succeeding."

Tesla bought almost 300 hectares (the size of more than 400 football pitches) in Grünheide from the state of Brandenburg to build the factory, which is scheduled to open in 2021. Tesla has ambitions to produce up to 500,000 cars a year at the factory, employing about 12,000 people.

But the company is in a race to get production up and running as Germany's big motor manufacturers are investing heavily in new electric car technology.

According to local media reports, Tesla has promised to relocate colonies of forest ants, reptiles and bats, and is working with conservationists. Last month, authorities defused seven Second World War bombs discovered at the site.

Tesla currently has two Gigafactories in the US and one in Shanghai, China.