Senate Republicans on Thursday blocked a Democratic effort to end the war in Iran, voting 51 to 48 against a war powers resolution in the first congressional vote on the conflict since their party's sweeping losses in the midterm elections.

The measure, which had passed the Republican-led House in September, would have directed President Donald Trump to end the hostilities or seek congressional approval to continue them. While largely symbolic and not sent to the president for his signature, Democrats have forced repeated votes on the war in both chambers this year as they campaigned against it. Virginia Sen. Tim Kaine, who has led the war powers efforts, said the American public is tired of the war and of escalating gasoline and diesel prices since it began.

Three Republicans — Susan Collins of Maine, Lisa Murkowski of Alaska and Rand Paul of Kentucky — voted for the resolution. Collins was defeated for reelection earlier this month. Democratic Sen. John Fetterman of Pennsylvania voted with Republicans to block it, as did Sen. Thom Tillis, R-N.C., after siding with Democrats on previous votes. Republican Sen. Tim Sheehy of Montana said before the vote that the United States should finish the job and protect the nation and its allies.

Democrats made the war a top issue in their midterm campaigns, and about six in ten voters said the United States made the wrong decision in taking military action against Iran, according to The AP Voter Poll of more than 100,000 voters. The Senate has held more than a dozen votes to end the war, most of which have failed, while the House first approved a war powers resolution in June and another in July.