The House advanced legislation Thursday that provides $300 million in aid to Ukraine after GOP leaders stripped the funding from a Defense spending bill amid opposition from Rep. Marjorie Taylor Greene (R-Ga.).

The chamber voted 217-211 to adopt the rule — which governs debate on legislation — for the five-page bill, kicking off debate in the chamber. The legislation appropriates the $300 million for fiscal 2024.

The $300 million in aid for Ukraine, which had initially been included in the Pentagon appropriations bill, has been a source of controversy within the House GOP conference, prompting Speaker Kevin McCarthy (R-Calif.) to flip-flop on the matter three times ahead of Thursday’s vote.

House GOP leaders moved late Wednesday night to strip the funding from the Defense bill and hold a separate vote on it amid uncertainty regarding the legislation’s chances of passing. Top Republicans made that decision even after the House — including a majority of Republicans — overwhelmingly rejected an amendment to strip the $300 million from the Defense appropriations bill.

The amendment, sponsored by Rep. Andy Biggs (R-Ariz.), failed in a 330-104 vote.

The late-night decision marked the third time the game plan for the Ukraine funding had changed.

Last week, McCarthy told reporters that he would strip the funding from the Defense bill and hold a separate vote on the aid after Greene joined a band of conservatives in voting down the rule for the appropriations measure, which was enough opposition to tank the procedural vote. It was the second time in three days that hard-liners sank efforts to advance the Pentagon spending bill.

But the day after McCarthy vowed to separate the Ukraine aid from the Defense bill, the Speaker reversed course, telling reporters that he would keep the funding for Kyiv in the legislation. He said he made that decision after recognizing that another appropriations bill set to come up — one funding the State Department and foreign operations — also included money for Ukraine.

The Speaker said stripping Ukraine aid from the State Department bill “became too difficult to do,” so he decided to keep the money in both. The two appropriations bills were included in the same rule, along with two others.

The House ultimately advanced the rule containing the four bills Tuesday, with Greene as the only Republican to vote “no.” But amid uncertainty over the Defense bill’s chances of passing, the House Rules Committee convened a last-minute hearing to remove the funds and hold a separate vote on them.

The funding is meant to “provide assistance, including training; equipment; lethal assistance; logistics support, supplies and services; salaries and stipends; sustainment; and intelligence support to the military and national security forces of Ukraine, and to other forces or groups recognized by and under the authority of the Government of Ukraine, including governmental entities within Ukraine, engaged in resisting Russian aggression against Ukraine, for replacement of any weapons or articles provided to the Government of Ukraine from the inventory of the United States.”