(a) General rule In the case of a nonresident alien individual, the deductions shall be allowed only for purposes of section
871 (b) and (except as provided by subsection (b)) only if and to the extent that they are connected with income which is effectively connected with the conduct of a trade or business within the United States; and the proper apportionment and allocation of the deductions for this purpose shall be determined as provided in regulations prescribed by the Secretary.
(b) Exceptions The following deductions shall be allowed whether or not they are connected with income which is effectively connected with the conduct of a trade or business within the United States:
(1) Losses The deduction allowed by section
165 for casualty or theft losses described in paragraph (2) or (3) of section
165 (c), but only if the loss is of property located within the United States.
(2) Charitable contributions The deduction for charitable contributions and gifts allowed by section
170.
(3) Personal exemption The deduction for personal exemptions allowed by section
151, except that only one exemption shall be allowed under section
151 unless the taxpayer is a resident of a contiguous country or is a national of the United States.