Harvard University is challenging President Donald Trump's effort to block foreign students from attending the Ivy League school - arguing that the president is just retaliating for the school's rejection of his demands.

The president signed an executive order on Wednesday entitled Enhancing National Security by Addressing Risks at Harvard University, which suspends the school's student visa program.

He claimed it was a national security issue, as he also restricted travel from a dozen countries.

Lawyers for the university quickly filed an amended complaint Thursday, calling Trump's order an end-run around a federal judge's previous ruling blocking the Department of Homeland Security from revoking the Ivy League's ability to host foreign students.

The filing attacks Trump's legal justification for the action - a federal law allowing him to block a 'class of aliens' deemed detrimental to the nation's interests.