Republican Reps. Greg Walden of Oregon and Jaime Herrera Beutler of Washington were the only lawmakers from the two Pacific Northwest states to support a hardline immigration bill that failed on the House floor Thursday.

The defeat of the measure came as lawmakers struggled to rewrite the nation’s immigration laws amid a national outcry over immigrant parents being separated from their children at the border.

Walden spokesman Justin Discigil said in an email that the congressman supported the measure sponsored by Rep. Bob Goodlatte, R-Virginia, because it “would help provide Oregon’s agriculture community with a stronger labor force that they have told us they need.”

The measure called for a revamped guest-worker program providing visas for up to 500,000 farm laborers that would also include the dairy and meatpacking industries. Walden is Oregon’s only GOP member of Congress.

Rep. Michael C. Burgess, R-Texas, left, and Rep. Greg Walden, R-Oregon, center, arrive for a closed-door conference with fellow Republicans after they met with President Donald Trump to discuss a GOP immigration bill, at the Capitol in Washington, Wednesday, June 20, 2018.

Rep. Michael C. Burgess, R-Texas, left, and Rep. Greg Walden, R-Oregon, center, arrive for a closed-door conference with fellow Republicans after they met with President Donald Trump to discuss a GOP immigration bill, at the Capitol in Washington, Wednesday, June 20, 2018.

J. Scott Applewhite/AP

All told, 41 Republicans joined every House Democrat in voting against the bill. Portland Rep. Earl Blumenauer called the GOP actions on immigration reform “mean and shallow.” He urged Republicans to work with Democrats to revamp the system.

Herrera Beutler’s spokeswoman, Angeline Riesterer, said in a statement that “the bill, while not perfect, took a forward step in improving our nation’s broken immigration system.” She said the measure prioritized border security while ensuring that family separation is never again adopted as U.S. policy.

But Washington’s other three GOP representatives — Dan Newhouse, Dave Reichert and Cathy McMorris Rodgers — all voted against the Goodlatte measure.

The legislation would have funded President Donald Trump’s border wall, cut legal immigration levels and ended preferences for would-be migrants related to U.S. residents. In addition, it provided only temporary relief for immigrants brought to the United States as children and cracked down on cities and states such as Oregon that limit law-enforcement cooperation with immigration authorities through so-called “sanctuary” policies.

McMorris Rodgers, chairwoman of the House Republican Caucus, said in a statement that she instead wanted to support a measure put forward by the House leadership that was seen as a compromise between the conservative and moderate wings of the party.

A vote on that bill was delayed until Friday because of concerns that it didn’t have enough support to pass.