President Donald Trump’s re-election campaign spent more than $1 out of every $5 on attorney fees this year as the president contended with the ongoing special counsel investigation and a new legal challenge from an adult-film star.

Of the $3.9 million Trump’s committee spent in the first quarter of 2018, more than $834,000 went to eight law firms and the Trump Corp. for legal fees, according to new Federal Election Commission records filed Sunday.

The latest figures bring the Trump campaign’s total spending on legal fees to nearly $4 million since the president took office, records show. In the last quarter of 2017, Trump’s campaign committee spent $1.1 million in legal fees.

The biggest share of legal payments in the first quarter of this year — about $348,000 — went to Jones Day, a law firm representing the campaign in the investigations by Special Counsel Robert Mueller and several congressional committees into Russian interference in the 2016 election.

Another $280,000 combined was paid to two law firms — Harder LLP and Larocca, Hornik, Rosen, Greenberg & Blaha — representing Trump and his personal attorney Michael Cohen in litigation with adult-film actress Stormy Daniels.

Daniels filed a lawsuit in March seeking to invalidate a 2016 agreement to keep secret a decade-old alleged sexual encounter with Trump in exchange for $130,000. The president and Cohen have filed their own suit against her, threatening to seek millions in damages.

The Trump campaign paid another $13,500 to McDermott Will & Emery, a firm that represents Cohen in the ongoing Russia investigations and a newly revealed criminal inquiry. That was a sharp drop from the previous quarter, when the campaign paid the firm nearly $215,000.

Federal prosecutors in Manhattan revealed in court papers Friday that Cohen, whose office and residences were raided by the FBI last week, has been under investigation for months.

The campaign also paid legal fees to the Trump Corp. — a company being run by Trump’s two older sons — and law firms Belkin, Burden, Wenig & Goldman LLP; Schertler & Onorato LLP; Seyfarth Shaw LLP; and Van Hoy, Reutlinger, Adams & Dunn PLLC.

In all, Trump’s campaign committee and two fundraising committees that jointly raise money with the Republican National Committee — Trump Victory and the Trump Make America Great Again Committee — together raised nearly $20.2 million in the first quarter, filings show.

That was a big increase over the last quarter of 2017, when the three committees together raised $12.5 million.

Unlike his predecessors, Trump began fundraising for 2020 soon after he won the presidency.

He continues to energize small-dollar donors, FEC filings show. In first quarter of 2018, 61 percent of the direct contributions to his campaign committee came from donations of $200 or less.

Trump’s campaign spent nearly $127,000 at the president’s private properties this year, including lodging and meeting fees at the Trump International Hotel in Washington, D.C., catering services at Trump Restaurants in New York, and rent to Trump Tower in New York.

The campaign did not immediately respond to a request for comment.

The Trump committee also paid nearly $1.7 million for digital consulting and online advertising services to Parscale Strategy LLC, the firm of Brad Parscale, Trump’s 2020 campaign manager. Parscale was the digital director of Trump’s 2016 campaign.

In addition to payments from the campaign, Parscale’s business also received $66,647 from the two fundraising committees and another $46,808 in consulting fees from the main super PAC supporting Trump, America First Action.

In late March, the campaign paid $22,000 to John McEntee, who joined as senior adviser for campaign operations after he was forced out of his position as Trump’s personal assistant earlier in the month. McEntee lost his White House job after an investigation found his gambling habits posed a security risk, The Washington Post reported.