Photograph: Angela Weiss/AFP/Getty Images

Donald Trump on Monday returned to the offensive over criticism of his immigration deal with Mexico, accusing the New York Times of “sick journalism” for reporting that key components of the deal, announced on Friday, had been agreed for months.

Related: ‘All I have done, no credit!’ Enraged Trump defends US-Mexico migrant deal

He tweeted: “When will the Failing New York Times admit that their front-page story on the the new Mexico deal at the Border is a FRAUD and nothing more than a badly reported ‘hit job’ on me, something that has been going on since the first day I announced for the presidency! Sick Journalism.”

Trump’s tweet followed a similar attack on Sunday, when, en route to Virginia for a second day of golf at his private club there, he accused the New York Times of “bad reporting” and “Fake News” for its coverage of migrants crossing the southern border into the US.

In the deal announced by Trump on Friday, Mexico agreed to use its national guard to keep migrants seeking US asylum in Mexico. In return, Trump said he would not go ahead with his threat to impose tariffs on all Mexican goods entering the US.

However, it emerged via the New York Times that Mexico had agreed to the deal in negotiations over the past six months, rather than because of Trump’s threat. The paper also reported that US attempts to reject asylum seekers that had traveled through Mexico but not sought refuge there first had failed.

Democrats seized on the reports.

Presidential contender Beto O’Rourke told ABC: “I think the president has completely overblown what he purports to have achieved. These are agreements that Mexico had already made, in some cases, months ago.

“They might have accelerated the timetable but by and large the president achieved nothing except to jeopardize the most important trading relationship that the United States of America has.”

On Monday, Trump continued to insist he would push ahead with tariffs should Mexico not fulfill the deal.

Story continues

An increase in migration to America’s southern border has prompted a series of increasingly belligerent tweets and proposals from Trump, including raising the possibility of indefinite detention of those who attempt to seek refuge in the US.

In May, more than 132,000 people were apprehended at the southern border, according to US Customs and Border Protection, the highest monthly number in the past 13 years. The large majority of these people were comprised of family groups, mostly from Central America.

A total of 24 immigrants have died in US Immigration and Customs Enforcement (Ice) custody during the Trump administration, according to an NBC analysis. The US court system is also overloaded, with almost 900,000 immigration cases pending.

Trump’s battle with large parts of the American media could bubble back into view this week with the publication of a book by CNN’s White House correspondent Jim Acosta.

Acosta had his White House pass temporarily revoked last year after a clash with Trump at a press conference.

His book, The Enemy of the People: A Dangerous Time to Tell the Truth in America, will be published on Tuesday. In May, the Guardian obtained an early copy.

Related: ‘The president's insane’: book by CNN's Jim Acosta charts Trump war on press

Acosta writes that when Trump began his attacks on “fake news” outlets including CNN, the Times, the Washington Post and more, it was an act conceived by adviser Steve Bannon in the absence of effective Democratic opposition. Acosta’s thesis is that this spiralled out of control, to potentially dangerous effect.

Acosta said on CNN on Sunday: “Some of his supporters feel it’s OK to lash out at us in ways that I think put us in danger. And I think we have to hit the pause button and think deeply about whether or not this is the kind of country we want to hand off to our kids.”

Acosta also said he wished “at times that the press had been in more solidarity with each other and standing up to this White House and say, ‘The president can’t call us the enemy of the people, we’re not going to go along with that.’

“We are not just here to report the news, we are here to defend the truth. When you have a president who has made 10,000 false or misleading statements since the beginning of his administration, that makes us fact checkers in real time.”

Acosta’s book contains anonymously sourced reporting likely to anger the president further.

One “senior White House official” is quoted as saying: “The president’s insane.”