A surprise late-session bill to let electric-car manufacturer Tesla sell direct to consumers in North Carolina materialized Wednesday at the legislature.

Other automobile manufacturers were not happy. But auto dealers, which have fought Tesla’s direct-to-consumers model in other states, are on board, seeking a carve-out to a state franchise system that generally requires manufacturers to sell through them as third-party dealers.

The new language in House Bill 617, which once focused on antique vehicle sales, represents a potential compromise after more than four years of back-and-forth over Tesla sales in North Carolina. The company has a store in Raleigh, but a Charlotte location was partially blocked by the state Division of Motor Vehicles when auto dealers objected.

The company can show cars in Charlotte; it just can’t sell them.

Manufacturers weren’t looped in on negotiations to change that until last Thursday, according to their lobbyist, Henry W. Jones Jr. The dealers and the manufacturers had been negotiating separate legislation, Senate Bill 413, that lays out a number of changes in the basic dealer-manufacturer relationship in North Carolina.

“We shook hands on 413,” Jones said. “The following day, they handed us this.”

Jones spoke against the Tesla bill during Wednesday’s Senate Commerce and Insurance Committee meeting. So did a representative for Honda, which has a pair of plants in North Carolina. If there’s to be an opt-out in the dealer franchise system, it shouldn’t just apply to Tesla, Jones said.

The bill would apply only to Tesla for now, though it doesn’t mention the company by name and other companies could eventually fit the legislative language. The legislation builds an exception into the state’s prohibition on manufacturer-run dealerships, but only for companies that sell vehicles that are solely electric.

Tesla has refused to sell through third-party dealers, a requirement in many states, saying it wants to deal directly with consumers. This bill would limit the company to six locations in North Carolina and forbid it from selling other car brands or used cars, other than those accepted as trade-ins.

The new bill language was introduced Wednesday in committee, but not voted on. More committee discussion is expected before a vote.

“We think it’s a limited exception,” North Carolina Automobile Dealers Association general counsel John Policastro said. “It still maintains the integrity, as much as possible, of the franchise system.”