Colorado state senators on Friday passed a bill allowing Rivian and other electric vehicle manufacturers to sell directly to consumers in the state — but they struck a provision that would have allowed all automakers, including those with franchised dealers, to do the same.

The Colorado Senate voted 22-12 on the bill, which now goes to the state House for consideration.

Before the bill’s passage, lawmakers removed its most controversial language, which would have allowed automakers to own, operate or control a dealership “that sells electric motor vehicles of a line-make manufactured by the manufacturer.” That had sparked fierce pushback by the Colorado Automobile Dealers Association, which opposed the idea of automakers with franchised dealership networks opening factory stores that would compete directly with dealer-owned stores.

“I want to say thank you to this entire chamber for everyone giving this bill the time and attention that it needed to get to this point,” said state Sen. Chris Hansen, a Democrat from Denver and a co-sponsor of the bipartisan bill, on the floor before the vote. “I think we’re in a good spot to move forward, allow competition to move into the market” and protect existing franchise agreements.

The language adopted Friday now allows automakers to own, operate or control one or more dealerships “if the manufacturer manufactures only electric vehicles and has no franchised dealers of the same line-make in this state.” The bill now would appear to limit direct sales to automakers that exclusively build EVs, such as Tesla and Rivian, a Plymouth, Mich., startup that has lobbied for the opportunity to sell directly to consumers in Colorado and other states.

Colorado Automobile Dealers Association President Tim Jackson said the association supported the amendment and is now neutral on the bill. It opposed the previous version.

The association contends that existing state franchise law already allows Rivian to apply for a dealer license, though Rivian has said the law is more ambiguous and the bill would provide more clarity.

“Based on the way the original bill was filed and passed on second reading, there would have been a lot of pullback of [dealer] investments,” Jackson said Friday. “This provides some security on that investment.”

Messages seeking comment were left Friday with Rivian.