(a) Order of Withdrawals.— A qualified withdrawal from a capital construction fund shall be treated as made—

(1)first from the capital account;

(2)second from the capital gain account; and

(3)third from the ordinary income account.

(b) Ordinary Income Account Withdrawals.— If a portion of a qualified withdrawal for a vessel, barge, or container is made from the ordinary income account, the basis of the vessel, barge, or container shall be reduced by an amount equal to that portion.

(c) Capital Gain Account Withdrawals.— If a portion of a qualified withdrawal for a vessel, barge, or container is made from the capital gain account, the basis of the vessel, barge, or container shall be reduced by an amount equal to that portion.

(d) Withdrawals To Pay Principal.— If a portion of a qualified withdrawal to pay the principal on indebtedness is made from the ordinary income account or the capital gain account, an amount equal to the total reduction that would be required by subsections (b) and (c) if the withdrawal were a qualified withdrawal for a purpose described in those subsections shall be applied, in the order provided in joint regulations, to reduce the basis of vessels, barges, and containers owned by the person maintaining the fund. The remaining amount of the withdrawal shall be treated as a nonqualified withdrawal.

(e) Gain on Property With Reduced Basis.— If property, the basis of which was reduced under subsection (b), (c), or (d), is disposed of, any gain realized on the disposition, to the extent it does not exceed the total reduction in the basis of the property under those subsections, shall be treated as an amount referred to in section
53511(c)(1) of this title withdrawn on the date of disposition of the property. Subject to conditions prescribed in joint regulations, this subsection does not apply to a disposition if there is a redeposit, in an amount determined under joint regulations, that restores the fund as far as practicable to the position it was in before the withdrawal.