The seven were taken during dawn swoops on Thursday in operations supported by police in London and Britain's third city of Manchester in northern England.
They are being held in an undisclosed prison.
(Reuters news agency quoting an unnamed Home Office source said all the seven were Algerians.It quoted the source as saying that the seven had been accused of being involved in a 2002 plot to manufacture the deadly poison ricin.)
"We can confirm that earlier on Thursday the immigration service detained seven individuals in accordance with the Home Secretary's powers to deport individuals whose presence in Britain is not conducive to the public good for reasons of national security," the spokeswoman said.
"The Immigration Act 1971 give the powers to deport individuals and to detain them pending deportation. The immigration service has detained the seven foreign nationals on this basis.
"They will be held in secure prison accommodation and we will not disclose their names."
London's Metropolitan Police and the Greater Manchester Police were the forces involved in assisting the immigration service.
A spokeswoman for the Met, which takes the lead on national security matters, confirmed their officers were involved in the swoop but said they had not made any arrests.
The July London bombings left
52 people dead
"Officers from the Metropolitan Police this morning at about 6am (0500 GMT) supported the immigration service. They served notices under the Immigration Act at a number of addresses across the capital.
"A number of people were detained by the immigration service and police assisted with the transfer of these people into the care of the prison service."
In the wake of bombings in July, which left 52 people dead, Home Secretary Charles Clarke said he would use his powers to deport and exclude foreigners engaging in behaviour deemed to threaten security.
Human rights groups have expressed concern over the government's desire to deport hardliners to countries where they may face torture or even execution.