Both of Iowa's senators voted against a bill that would block President Donald Trump's emergency declaration for border wall funding Thursday.

The legislation passed the Senate with a 59-41 vote, but is expected to get vetoed by the president — Trump tweeting out "VETO!" shortly after the vote. Iowa's Sens. Chuck Grassley and Joni Ernst, both Republican, voted against the bill to halt the emergency funding.

Grassley said last week that he'd be willing to work with members of Congress to "curtail the powers of the executive" given in legislation like the National Emergencies Act, but that Congress had given the president the power to use emergency funding in the first place.

"How can you blame the president when the Congress gave him the authority?" he said earlier in March. "He's doing what Congress said he can do."

During the government shutdown, Ernst said the U.S. doesn’t need to build a wall or fence along its entire southern border. Like Grassley, she supports legislation to limit presidential power on emergency funding in the future, according to a tweet.

"While I’ve consistently stated this is not the approach I would have preferred, I do recognize the need to secure our border," Ernst said on Twitter.

The emergency declaration would authorize $6 billion to be spent on the border wall that had been appropriated by Congress for Pentagon programs and military construction projects.

If Congress wanted to overturn Trump's veto, both the House and Senate would need a two-thirds vote. Opponents to Trump's emergency funding would have to convince eight more senators to take their side if that effort were to be successful.

In a recent Des Moines Register/CNN/Mediacom Iowa Poll, most registered Republicans said they supported Trump's use of the emergency powers.

The new Iowa Poll shows 63 percent of Iowa registered Republicans believe that Trump had the right to use emergency powers to obtain border-wall money and that it was the right thing to do. Another 6 percent believe that he had the legal right to do so, but that it was the wrong thing to do. Twenty percent think he did not have the right to use emergency powers that way; and 6 percent are unsure.