People across the United States rushed this week to pay their 2018 property taxes early, hoping to take advantage one last time of a federal deduction for state and local taxes that will be scaled back under the tax-code overhaul signed by President Donald Trump.

On Wednesday, however, the Internal Revenue Service announced that those prepayments could be deducted only in limited circumstances, a decision that appeared to invalidate many taxpayers' efforts and raised the prospect that local governments could come under pressure to refund millions of dollars.

The announcement stoked confusion surrounding one of the most controversial elements of the tax law - a $10,000 cap on deductions for state and local taxes that will disproportionately affect higher-tax, Democratic-leaning states. It also offered a glimpse of the kind of hiccups that could arise in coming weeks as the IRS releases guidance on other facets of the bill, the largest overhaul of federal tax law in three decades.

In affluent states with high taxes and property values, local officials have been besieged in recent days by people trying to pay their 2018 property taxes early so they can deduct those payments before the cap takes effect.

However, the IRS said Wednesday that filers could only avoid the cap by paying property taxes that have been assessed in 2017. Many local governments have not completed assessments for upcoming years.

Critics said the last-minute confusion underscored the haste with which Republicans passed their tax bill, completed in record time for such a far-reaching piece of legislation.

"This is not the way to do legislation that will massively impact the entire economy. It sets off a flurry of action from people trying to save money, and they act as rash as the legislators who pushed this thing through," said Philip Hackney, a tax expert at Louisiana State University.

That confusion was echoed among taxpayers - some following the advice of their accountants - who interrupted their holiday activities to line up in sub-freezing temperatures at tax offices.

Affluent Fairfax County, Virginia, collected nearly $16 million in tax prepayments on Tuesday alone, county spokesman Jeremy Lasich said, with more money flowing in Wednesday. He said the county would devise a reimbursement plan if it cannot accept the prepayments. "We don't know the full impact of that [IRS] statement yet," he said. "We're still studying that."

Brian Lowit, 43, of Baileys Crossroads, Virginia, said his accountant told him that prepaying his 2018 property taxes this week could save him more than $1,000. He then checked with his mortgage company, where an operator told him there were 150 people on hold behind him ready to ask the same questions.

Eventually, he wired $5,100, a full year's payment, to Fairfax County. Soon afterward, he learned of the IRS announcement.

"It's a nightmare," Lowit said. "I'm definitely frustrated, annoyed and irritated. The rush to get that bill done screwed everyone up. It's insanity and it's stupid."

The deduction for state and local taxes is especially popular in high-income, highly taxed and often left-leaning states: More than 37 percent of tax returns in Virginia included the deduction in 2015, compared with 23 percent in Texas, according to the nonpartisan Tax Policy Center. In the District, 40 percent of returns deducted state and local taxes, and in Maryland, 46 percent.

Nationally, more than 96 percent of tax increases resulting from the loss of the state and local deduction will be paid by those in the top 20 percent of the income distribution, a recent analysis by the Tax Policy Center found.

Republican supporters of the bill say the cap on deductions and other changes were needed to offset a reduction in personal and corporate income tax rates.

The tax law explicitly states that the $10,000 deduction cap cannot be avoided by prepayment of 2018 income taxes but had left open the question of whether it applied to prepaid property taxes.

"There are so many questions around this," said Sean Zielenbach, a business owner in Alexandria, Virginia, who prepaid his $12,000 property tax bill for 2018 early Wednesday only to learn later in the day, after the IRS announcement, that he might not benefit.

In Virginia, counties mail out tax assessments in February.

"It's as though they set up just to harm folks who live in higher-tax states," Zielenbach said. "There are definitely winners in this tax bill, but it's not ordinary folks and it's not folks who live in New York, New Jersey, Connecticut or places like Alexandria, which, oddly enough, didn't vote for [Trump]."

While the IRS announcement sought to clarify rules regarding prepayment, many questions remain. Counties across the country have different laws and timelines for assessing property taxes, potentially making it difficult for the agency to enforce its interpretation, tax experts said.

"It's really difficult to guess what will happen if folks don't follow this ruling," said Bradley Heim, a professor at Indiana University who worked in the Treasury Department's Office of Tax Analysis under President George W. Bush.

Andy Grewal, a tax expert at the University of Iowa, said local lawmakers could try in the remaining days of the year to formally change their assessment dates but cautioned that doing so retroactively "would raise some thorny legal questions."

On Wednesday night after the IRS announcement, Montgomery County, Maryland, council member Nancy Floreen took to Twitter, saying that those still wondering if they could prepay should seek out expert tax advice before doing so.

"The plot thickens," she wrote.

The Washington Post's Rachel Siegel and Perry Stein contributed to this report.