Tesla has finally made a breakthrough in its long-standing legal battle with the state of Michigan that will allow it to sell and service vehicles in the state.

Under the settlement reached between Tesla and the state, it was agreed “that any Michigan resident may lawfully buy a Tesla and have it serviced in Michigan.” Up until now, local residents could view Tesla models at a company showroom in Troy, Michigan but staff could not discuss pricing or financing terms and shoppers either had to buy their vehicles online or through an out-of-state sales office. They also had to travel out of state to take delivery of their vehicles and have been forced to send them to surrounding states to be serviced, Bloomberg reports.

Read More: Tesla Sues Michigan State After Direct Sales Ban

In a statement from the Michigan Attorney General, one key stipulation has been made that while Tesla will be permitted to sell cars to customers in Michigan, it can only do so if “the sales contract indicates the sale took place in a state other than Michigan.”

Tesla first filed a lawsuit in the U.S. District Court in 2016 in a bid to overturn the state’s ban on automakers selling vehicles directly to customers. Tesla is engaged in similar legal battles in states including Texas and Connecticut.

Unlike most car manufacturers that operate large networks of franchised dealerships, Tesla has small showrooms in areas like shopping malls where customers can view and buy vehicles. Additionally, shoppers can buy Tesla models online. In 2014, Michigan’s then-governor Rick Snyder signed a bill into law prohibiting Tesla from selling cars in the state.