Eirik Jensen, who was responsible for combating organised crime in the capital Oslo, was arrested in 2014.
On Monday, a court found he had received at least 667,800 kroner (€71,300, £63,200) in bribes to help smuggle tonnes of hashish into Norway.
He denies the charges and plans to appeal, his lawyer said.
Jensen's 21-year sentence for corruption was the maximum permitted under the law, and a rare event in Norway.
It is frequently named one of the least corrupt countries, and placed sixth in the 2016 global rankings by anti-corruption watchdog Transparency International.
Jensen helped smuggle nearly 14 tonnes of the cannabis resin between 2004 and 2013, his trial heard.
A key witness was his co-conspirator, hashish smuggler Gjermund Cappelen, who admitted importing the drug and was sentenced to 15 years in prison.
Norwegian media report his sentence was reduced in exchange for his co-operation in exposing Jensen.
Jensen and Cappelenm exchanged hundreds of text messages over a decade, some of which included coded details of police and customs activity, Oslo's district court was told.
Jensen's legal team maintained they were indicative of a police officer conducting normal investigative work with an informant. Judges, however, were not convinced.
The court found the messages had been sent in "simple codes", broadcaster NRK reports (in Norwegian), and that texts about "sunshine" were designed to indicate that Cappelenm was not under police observation and could safely import his product.
Reading the verdict, Judge Kim Heger said the high-ranking officer had deliberately contributed to the import of drugs, in a case which was unique in the country's legal history.
It has attracted widespread attention in Norway, dominating headlines.