RICHMOND, Va. (AP) – A sanctuary cities bill was passed even though the governor of Virginia has vowed to veto the bill.

The sanctuary cities bill initially failed Tuesday on a 50-50 deadlock.

However, the vote against the bill by Del. Gordon Helsel was apparently a mistake and, on the second try, the bill was passed 51-49 on party lines.

Gov. Ralph Northam has vowed to veto the bill, which Republicans say would prevent cities from resisting federal immigration law in order to shelter undocumented immigrants who are accused of crimes.

Democrats have long opposed the legislation, saying it’s ill-defined and unnecessary because Virginia doesn’t have any sanctuary cities.

The bill now goes to the Senate.