NEW YORK (AP) — Citigroup reported an $18.3 billion loss in the fourth quarter on Tuesday — effectively wiping out the company's full-year 2017 profit — as the financial conglomerate had to take more than $20 billion in accounting write-downs related to the new tax law.

The New York-based bank said it had a loss of $7.15 a share, compared with a profit of $3.57 billion, or $1.14 a share, in the same period a year ago.

Citigroup's loss, one of the biggest in its history, was mostly caused by accounting adjustments the bank had to make to bring it into compliance with the new tax law that was enacted last month. Excluding these one-time charges, which were expected by analysts, the bank earned a profit of $3.7 billion, or $1.28 a share.

Like many banks after the 2008 financial crisis, Citigroup had billions of dollars of what are known as deferred tax assets on its balance sheet. They are basically credits it could have used to pay future income taxes. These credits built up after the big Wall Street banks took billions of dollars in losses from bad mortgages and other toxic assets.

Citigroup, in particular, had a large amount of these credits on its balance sheet because the bank came dangerously close to failure in 2008 and required government intervention to keep it afloat. Because the new tax bill lowered the corporate tax rate to 21 percent, the value of those tax-deferred assets had to be written down.

Citigroup wrote off $19 billion of these assets last quarter, and will still have roughly $23 billion of the credits still sitting on its balance sheet, Citigroup Chief Financial Officer John Gerspach said in conference call with reporters.

Despite the write off, Gerspach said the new tax law will be a "significant long-term positive for Citi." The bank expects its effective tax rate to fall to 25 percent from its current 30 percent level. That's higher than the 20 percent rate that JPMorgan and Wells Fargo estimated for themselves, but it largely has to do with Citi having more foreign operations than its competitors.

Other banks are expected to, or have already taken, similar write-downs, as they report their results last week and this week. JPMorgan Chase took a $2.4 billion charge when it reported its results Friday.

Citigroup also took a $3 billion charge for foreign earnings it will bring back to the U.S. Unlike most of the other big banks, Citi has substantial foreign businesses — particularly in Mexico and Asia — and had been holding those earnings abroad waiting for favorable tax treatment.

In Citi's individual businesses, the bank's consumer financial arm reported revenue of $8.4 billion, up 6 percent from a year earlier, helped by higher interest rates.

In its trading arm, revenues fell 17 percent to $3.4 billion. Like other banks, Citi has been dealing with abnormally quiet financial markets for most of 2017, which kept investors from trading and made it more difficult for Citi traders to take advantage of big swings in asset prices.

Citi reported quarterly revenue of $17.26 billion, up from $17.01 billion in the same period a year ago, beating analysts' expectations.

Citigroup's stock rose 96 cents, or 1.3 percent, to $77.83 in early trading.