26 USC 906 - Nonresident alien individuals and foreign corporations

(a) Allowance of credit 
A nonresident alien individual or a foreign corporation engaged in trade or business within the United States during the taxable year shall be allowed a credit under section 901 for the amount of any income, war profits, and excess profits taxes paid or accrued during the taxable year (or deemed, under section 902, paid or accrued during the taxable year) to any foreign country or possession of the United States with respect to income effectively connected with the conduct of a trade or business within the United States.
(b) Special rules 

(1) For purposes of subsection (a) and for purposes of determining the deductions allowable under sections 873 (a) and 882 (c), in determining the amount of any tax paid or accrued to any foreign country or possession there shall not be taken into account any amount of tax to the extent the tax so paid or accrued is imposed with respect to income from sources within the United States which would not be taxed by such foreign country or possession but for the fact that
(A) in the case of a nonresident alien individual, such individual is a citizen or resident of such foreign country or possession, or
(B) in the case of a foreign corporation, such corporation was created or organized under the law of such foreign country or possession or is domiciled for tax purposes in such country or possession.
(2) For purposes of subsection (a), in applying section 904 the taxpayers taxable income shall be treated as consisting only of the taxable income effectively connected with the taxpayers conduct of a trade or business within the United States.
(3) The credit allowed pursuant to subsection (a) shall not be allowed against any tax imposed by section 871 (a) (relating to income of nonresident alien individual not connected with United States business) or 881 (relating to income of foreign corporations not connected with United States business).
(4) For purposes of sections 902 (a) and 78, a foreign corporation choosing the benefits of this subpart which receives dividends shall, with respect to such dividends, be treated as a domestic corporation.
(5) For purposes of section 902, any income, war profits, and excess profits taxes paid or accrued (or deemed paid or accrued) to any foreign country or possession of the United States with respect to income effectively connected with the conduct of a trade or business within the United States shall not be taken into account, and any accumulated profits attributable to such income shall not be taken into account.
(6) No credit shall be allowed under this section against the tax imposed by section 884.