Iran has condemned the "illegal and inhuman" treatment of its nationals by US border security officers after reports emerged of a student being deported despite having a valid visa.

Tensions have soared between Tehran and Washington since a US drone strike killed Iranian general Qassem Soleimani in Baghdad on January 3.

More:

An Iranian student was headed to a university in Boston but his visa was cancelled at the airport and he was deported by immigration officials.

Boston-based lawyer Kerry Doyle, who took on the case along with lawyers from two other private firms and the ACLU, said Abadi shared immigration paperwork electronically that showed he had been denied entry due to a concern that he would remain in the United States beyond the scope of his student visa.

"Such absolutely discriminatory measures that only happen over people's race, nationality or religion are against international human rights laws and principles," Iran's foreign ministry spokesman Abbas Mousavi said.

"These individuals were questioned by America's border security over their political views and beliefs, and their social media accounts were forcefully entered," he said in a statement.

Five days after the killing of Soleimani, Iran retaliated by launching a wave of missiles at US troops stationed in Iraq.

Tehran was still on high alert hours later when its air defences mistakenly shot down a Ukraine International Airlines passenger jet, killing all 176 people on board.

"These actions against Iranians are in line with the American regime's hostile and hateful policy against Iran ... now manifested in harassing Iranians at America's borders," Mousavi said.

The spokesman warned the US could face action "through human rights bodies", without elaborating.

The American Civil Liberties Union of Massachusetts said at least 10 Iranian students had been denied entry at US airports since August 2019, with seven of those denials occurring at Logan International Airport.