New York CNN Business  — 

Tesla is finally coming to Michigan, the home of the US auto industry.

After a legal battle that stretches over years, Tesla has finally won the right to deliver and service cars in the state, according to a settlement between the automaker and the state of Michigan that was filed in federal court Wednesday. The settlement is set to be announced on Wednesday.

Tesla (TSLA) has a showroom in Troy, Michigan, a suburb of Detroit, but employees could not discuss pricing or financing terms with potential buyers. Until now, Tesla (TSLA) buyers from Michigan had to travel out of state to take possession of cars they purchased online or complete the sale at an out-of-state sales office. Tesla (TSLA) was not able to open a service center to fix the cars in Michigan.

Tesla sells all of its cars through company-owned stores, rather than dealerships which are independently owned businesses. That makes Tesla unique – its other American rivals use a dealership model. Each state has dealership laws controlling the sale of vehicles. Those laws in Michigan prevented Tesla from selling and servicing the vehicles.

Under the deal with Michigan, Michigan Tesla buyers will still end up with a car titled in another state, or in Canada. But they can use that out-of-state title to title and register the car in Michigan.

Tesla had to wage a state-by-state legal fight earlier in its history to win the right to sell cars directly to consumers. Teslas are still prohibited from being sold or serviced in several states including New Mexico, Alabama and South Carolina.