Claus Hjort Frederiksen had been accused by prosecutors of illegally disclosing "highly classified information".
Danish MPs have blocked prosecutors from charging the country's former defence minister with revealing state secrets.
Denmark's justice minister announced on Thursday that lawmakers had refused to lift the parliamentary immunity of Claus Hjort Frederiksen.
Prosecutors have accused Hjort Frederiksen of the "unauthorised disclosure of highly classified information".
But a majority of political parties and independent MPs have pledged to block the charges, according to the justice ministry.
Hjort Frederiksen has been an MP since 2005 and served as the country’s defence minister from November 2016 to June 2019.
Exact details about the charges against him have not been revealed due to the "special nature of the case," according to a statement. If convicted, the 74-year-old faces up to 12 years in prison.
"According to my understanding I have not revealed any secrets," Hjort Frederiksen told broadcaster TV2.
Danish media have speculated the case might be linked to allegations that Denmark’s foreign secret service helped the United States spy on European leaders, including former German Chancellor Angela Merkel.
In a December interview, Hjort Frederiksen spoke about a secret eavesdropping deal the United States and Denmark made in the late 1990s.
“I must risk a prison sentence. ... I have informed [Danish officials] that this agreement existed," he said.
Danish broadcaster DR has reported that the Danish Defence Intelligence Service (FE) conducted an internal investigation in 2014 into whether the US National Security Agency had used the relationship to spy on Denmark and other neighbouring countries, including Germany, France, Sweden and Norway.
There are also reports that the case against Hjort Frederiksen could be linked to the December arrest of Denmark’s former foreign intelligence chief.
Lars Findsen was held in pre-trial custody on a preliminary charge of “disclosing highly classified information” before an appeals court ordered his release in February.
Details of the allegations against Findsen -- who was suspended in August 2020 -- also are unknown, and the case has been shrouded in secrecy.