Donald Trump used a now-illegal tax loophole to avoid paying potentially hundreds of millions of dollars in tax in a way which, even at the time, his own lawyers said was considered questionable, according to a report.

Tax documents from the Republican’s failing Atlantic City casino empire in the early 1990s show he was able to cancel vast sums of debt and use other people’s losses to offset his own taxable income for years afterwards.

The New York Times said the manoeuvre, which Mr Trump’s own lawyers advised him the IRS would likely find improper if he were audited, was almost identical to a tax move that was already outlawed, but differed in minor details.

Mr Trump operated three casinos in Atlantic City which had, by 1992, all declared bankruptcy. As he struggled to keep afloat, the business tycoon asked investors and bondholders to cancel a vast sum of debt.

They were forced to agree to protect what was left of their investment - but under US tax laws, the cancelled debt should have counted as taxable income for Mr Trump.

Instead, the Times said, Mr Trump made the debt disappear by swapping it for equity in his “partnership” - the entity through which he ran the casino business - that was worth next to nothing.

At the time, opinion letters from Mr Trump’s own lawyers at Willkie Farr & Gallagher said there were at least six reasons the IRS, were it to audit him, might find the move to be improper.

Tax experts told the Times the manoeuvre may also explain how the Republican presidential candidate posted a one-year loss of more than 900 million dollars (£738m) a few years later, enabling him to avoid paying federal income taxes for perhaps 18 years.

John L Buckley, who served as the chief of staff for Congress’s Joint Committee on Taxation in 1993 and 1994, told the newspaper Mr Trump was trampling over one of the fundamental principles of US tax law by using his investors’ losses to avoid paying his own taxes years later.

“He deducted somebody else’s losses. He is double dipping big time.”

Congress explicitly outlawed the manoeuvre Mr Trump used in 2004. Hillary Clinton, then a New York senator, was among those who voted to close the loophole.

Mr Trump himself did not respond to the Times over what the documents were reported to show, but his campaign described it as in keeping with “all taxpayers who take the time and spend the money to try to comply with the dizzyingly complex and ambiguous tax laws without paying more tax than they owe”.

Hope Hicks, Mr Trump's spokeswoman, told the Times that its reporting "suggests either a fundamental misunderstanding or an intentional misreading of the law".