For the first time, a bill extending access to driver’s licenses for undocumented immigrants has passed the Assembly, but the bill faces an uncertain future in the state Senate.

The debate over a bill allowing undocumented immigrants access to driver’s licenses lasted for hours — taking place against the backdrop of a heated national conversation surrounding immigration — and was just days after a Siena College poll found a majority of voters opposed it.

“People are being villainized because of immigrant status — I think that does hurt the poll numbers,” said Assembly Speaker Carl Heastie. “But when you are looking at [it] from the human side and the pure economics and safety, it’s a no-brainer.”

The bill’s passage is a victory for advocates who have argued for the last six months the bill has economic merit that would bolster traffic safety and insure drivers.

“We applaud Speaker Heastie and the Assembly for doing the right thing and passing the Green Light NY bill that will bring hundreds of thousands of immigrants out from the shadows and make New York’s roads safer,” said Steven Choi, the executive director of the New York Immigration Coalition.

The bill was approved 86-47, with several Democrats voting against the legislation, including Assemblyman Angelo Santabarbara.

“There’s a lot of rights and privileges that come with [a] citizenship,” Santabarbara said. “The correct thing to do is become a citizen, get on a path to citizenship, just like my parents went through.”

And it’s not clear if the bill — along a third rail in New York politics since then-Gov. Eliot Spitzer proposed and withdrew the proposal in 2007 — can pass in the state Senate.

“I think it makes the streets safer, saves the state money, and makes sure people who are in car crashes are insured,” said Sen. Mike Gianaris, the deputy majority leader. “These are all positives. There’s really no meritorious agrument against it and I’m hopeful we can get it done.”

Gov. Andrew Cuomo has publicly doubted whether the votes are available in the Senate for it to pass, but reiterated on Wednesday he would sign the measure if approved lawmakers.

“I supported it when Eliot Spitzer first proposed it when I was attorney general.” Cuomo said. “So, I support it.”

Meanwhile, Republican lawmakers in the Assembly questioned whether the state should be weighing in on an issue normally reserved for the federal government.

“I definitely don’t think the state should be involved with a federal or state immigration policy,” said Assembly Minority Leader Brian Kolb. “That’s up to Washington.”

For now, a Senate vote on the bill is yet to be scheduled. The legislative session is due to end in a week.