An Australian mining lithium project that has an agreement to supply Tesla Inc. faces a legal hurdle that may delay plans to start production, potentially spurring shortages of the mineral used in batteries for electric cars.

A court in Perth recommended Western Australia’s mining ministry shouldn’t approve an exemption from past minimum exploration-expenditure obligations at the Mt. Holland hard-rock project, lithium giant SQM said in a statement on Wednesday.

Development of Mt. Holland, owned by SQM and Kidman Resources Ltd., could be slowed if the ministry doesn’t award the exemption, SQM said.

Analysts expect a small lithium surplus the next few years, and any snags at major suppliers risk throwing the market into deficit, according to Bloomberg NEF. In May, Tesla signed a three-year supply contract with Kidman.

The deal with a junior miner that isn’t expected to start producing until 2021 shows how electric-car and battery makers are rushing to get supply of the mineral. “This is going to be a concern to Tesla — they had hopes to lock in supply by signing this off-take with Kidman,” said James Frith, a BNEF analyst in London.