Tesla Inc. for the first time would be permitted to sell and service its vehicles in Michigan under a settlement with Michigan Attorney General Dana Nessel expected as soon as Wednesday, according to a person familiar with the matter, ending a years-long feud between the Silicon Valley automaker and the home of its three Detroit rivals.

The settlement could be a test for the automakers and dealers across Michigan, where the quick, stylish electric vehicles from scrappy Tesla haven't been easy to buy. The California-based automaker would soon be free to sell its vehicles directly without using dealerships or subsidiaries just as General Motors Co., Ford Motor Co. and others ramp up electric vehicle production with new models such as the Ford Mach-E SUV or GM's forthcoming Hummer EV pickup.

"Michigan was one of the staunchest critics of Tesla’s use of online retailing without traditional franchise dealers," said Karl Brauer, an auto analyst with Kelley Blue Book. "The domestic automakers felt it was patently unfair to give Tesla that much control over its retailing while every other automaker follows franchise dealer laws."

Tesla had been barred from servicing any of its vehicles in Michigan, or selling its vehicles directly to consumers since former Gov. Rick Snyder signed a bill into law in October 2014 that he said "clarifies and strengthens” the existing law that prohibited direct sales of new cars."

The automaker would now be able to service its vehicles through a subsidiary, deliver vehicles to customers in Michigan, and assist with sales through smaller gallery locations, the source said.

That'd be a remarkable change for Tesla devotees — and those who want to be. Tesla customers in Michigan are forced to Cleveland, Columbus, even Chicago, to take delivery of their vehicles or have them serviced. To meet Michigan demand, the automaker opened a service center in Toledo, part of CEO Elon Musk's push to expand Tesla's service network.

The settlement between the Silicon Valley automaker and the attorney general is expected to be announced Wednesday, the Associated Press also reported, citing an anonymous source. Bloomberg first reported that Tesla had reached a settlement with the state, and the AP said the settlement would allow the automaker to sell and service its vehicles in Michigan.

Representatives from the attorney general's office declined to comment. Tesla officials declined to comment on the pending settlement.

The settlement would end a Tesla lawsuit against the state over a law that banned company-owned stores and barred Tesla from opening service centers.The settlement could cause other states that also have stopped Tesla from selling to follow suit, a potential win for Tesla's effort to peddle its Model 3 compact EV to a broader market.

Would-be Tesla owners living in Michigan have been forced to shop for the vehicles out of state or at a "gallery" in the Somerset Collection Mall in Troy before taking delivery of the vehicle outside the state and driving it home. Those working at the gallery were previously barred from initiating or assisting any sale of a vehicle.

Under terms of the settlement, Tesla would be allowed to deliver vehicles in Michigan so long as they are first titled outside the state. A Michigan owner could then get the title switched to Michigan.

Michigan in 2016 officially denied Tesla a dealership license to sell vehicles here. The state requires dealers to contract with an auto manufacturer to sell vehicles, meaning an automaker could not act as both dealer and manufacturer.

The automaker has fought since at least 2014 to sell its vehicles directly to consumers in Michigan. The state laws blocking Tesla from selling its vehicles were originally established to prevent unfair competition between vehicle manufacturers and affiliated dealers. They also prevent arbitrary closings of dealerships by automakers.

Over the years, such unlikely supporters as the Federal Trade Commission have championed Tesla's direct-selling model, much to the consternation of traditional dealer lobbies that wield considerable lobbying power in state capitals, Lansing included.

"When the automobile industry was in its infancy, auto manufacturers recruited independent, locally owned dealers to reach consumers in localities across the country," the FTC wrote in a blog in 2014. "State laws progressively embraced wide-ranging protections for these dealers due to a perceived imbalance of power between the typically small local dealers and major national manufacturers.

"These protections expanded until in many states they included outright bans on the sale of new cars by anyone other than a dealer — specifically, an auto manufacturer. Instead of 'protecting,' these state laws became 'protectionist,' perpetuating one way of selling cars — the independent car dealer. Such blanket bans are an anomaly in the broader economy, where most manufacturers compete to respond to consumer needs by choosing from among direct sales to consumers, reliance on independent dealers, or some combination of the two."

Before an amendment to Michigan law in October 2014, Tesla believed it had a right to not just open a retail store but a full dealership. GM and Ford supported the so-called “anti-Tesla” bill that was initiated by the Michigan Automobile Dealers Association in 2014, a bill state officials insisted was not anti-Tesla.

"It will be interesting to see how readily Motor City residents take advantage of Tesla’s local availability," Brauer said. "At the very least, this latest win for Elon Musk confirms that even" Fiat Chrysler Automobiles NV's "Ford’s and GM’s influence on Michigan’s state government couldn’t stop Tesla’s incursion."

ithibodeau@detroitnews.com

Twitter: @Ian_Thibodeau