Forget Snapchat. Facebook's biggest threat right now may be Uncle Sam.

Facebook (FB) disclosed on Thursday that it could owe billions due to an IRS investigation into the way it moved assets to an Irish subsidiary to avoid higher taxes.

The IRS tax penalty could total $3 billion to $5 billion, plus interest, according to a Facebook filing with the Securities and Exchange Commission. If so, Facebook says the penalty could have a "material adverse impact" on its financial position.

The tax issue was first disclosed publicly three weeks ago when the U.S. Justice Department filed a lawsuit forcing Facebook to comply with the ongoing IRS investigation. No figures were provided at the time for possible penalties.

The investigation dates back to 2010 when Facebook shifted the rights for its worldwide business, excluding the U.S. and Canada, to Facebook Ireland as part of a complex maneuver to reduce its tax payments.

That transfer included certain hard to quantify assets like its "user base, online platform and marketing intangibles."

The IRS came to believe that Ernst & Young, the accounting firm tasked with valuing the assets in this transfer, may have "understated" the worth of these intangibles by "billions of dollars," according to a copy of the legal filing provided to CNNMoney.

Related: Facebook plans for life after Zuckerberg

"We do not agree with the position of the IRS and will file a petition in the United States Tax Court challenging the Notice," Facebook wrote in its filing this week.

Facebook, along with tech peers like Apple (AAPL) and Google (GOOGL), has come under fire in recent years for curbing assets in Ireland and other countries that serve as tax havens thanks to their low corporate tax rate.

In March, Facebook caved to the pressure somewhat and agreed to stop routing revenue earned in the U.K. through Ireland.

The IRS has been working to gather information on the 2010 Irish agreement for years, with limited cooperation.

Nina Wu Stone, an investigator with the IRS, noted in one of the filings that she issued six summonses last month for Facebook to produce records related to the asset transfer. Facebook failed to comply with those requests.

Earlier this week, the IRS disclosed that Facebook ignored a seventh summons as well.