The mullah, 58, who has been living in Norway since 1991, founded the radical Islamist group Ansar al-Islam. He was released from prison at the end of January after serving a two-year, 10-month sentence for making threats against Prime Minister Erna Solberg, before she came to office, and three Kurds.
The police had invoked special measures to order Krekar, whose real name is Najmeddine Faraj Ahmad, to live in a refugee centre in Kyrksæterøra, a village of 2,500 people situated 500 kilometres (300 miles) from the capital.
The defence had argued that the court needed to examine the legality of the decision, which prohibits the married father of four from leaving the village and which requires him to report to local police three times a week.
"With some misgivings, the court considers that the basic national interest, at least until , must take precedence over Faraj's right to a family life, freedom to move freely throughout the country and to choose his own place of residence," read the court's decision.
Krekar's lawyer, Brynjar Meling, appealed the decision and asked that it be suspended pending review. Krekar has been living under risk of deportation since 2003 after Norwegian
authorities ordered him to be expelled, claiming he posed a threat to national security.
While Norway's court system has upheld the ruling, Norwegian law bars him from being deported to Iraq, where he risks the death penalty. While Krekar acknowledges having co-founded Ansar al-Islam, he insists he has not led the group since 2002.
The preacher and the group Ansar al-Islam figure on United Nations and US lists of terrorist groups or individuals.