The Attorney General for England and Wales, Mr John Morris QC, last night obtained an injunction banning News Group Newspapers, publishers of the Sun, from naming the cabinet minister's son at the centre of drug-dealing allegations.
The move came after the arrest yesterday of Ms Dawn Alford, the Mirror reporter who initially broke the story.
It will heighten controversy over alleged political interference in press reporting of the case, after a day in which senior Conservatives demanded to be told whether the handling of the matter was being affected by the involvement of a government minister.
The order was granted by the judge, Mr Justice Moses, at 6.30 p.m. within hours of the print deadline for today's Sun.
A spokesman for the Treasury Solicitor's office said: "The basis of the Attorney General's application, which was upheld by the judge, was in summary that publication of the young person's name would be a contempt of court, in that there is a likelihood that it would interfere with the course of justice."
The Attorney General's office added: "The attorney was acting independently of government and in his capacity as guardian of the public interest. He took the decision after consultation with leading counsel.
"In granting the injunction, Mr Justice Moses said that the attorney's application was properly brought in order to protect the integrity of the criminal justice system."
No media organisation has yet identified the youth who allegedly sold £10 worth of cannabis resin to Ms Alford. She was operating undercover shortly before Christmas after receiving a tip-off that the youngster was peddling drugs.
Under the Children and Young Persons Act 1933, the youth is entitled to anonymity once proceedings against him have begun. However, there are differing opinions in legal circles on whether proceedings begin with the arrest, charge or appearance in court.
The Mirror editor, Mr Piers Morgan, said: "The Mirror has stated from the start that we have never had any intention of naming the minister's son, because he is deemed to be a minor in the eyes of the law, so we have not considered publishing his identity or testing the law.
"However, the situation has become increasingly farcical in recent days, with the arrest of our reporter, and I can understand why other newspapers may have chosen to test the law in this way, because there is a vague area as to when proceedings become active."
The move to arrest Ms Alford was described as unprecedented by lawyers and journalists.
Mr Morgan said the reporter's arrest was a threat to investigative journalism.
The Guardian Service adds: Earlier, the controversy was given a fresh twist when Sir Brian Mawhinney wrote to the Director of Public Prosecutions and the head of the Metropolitan Police about the handling of the case.
Sir Brian, the shadow home secretary, said that a series of vital questions needed to be answered about the "unusual nature" of the investigation as police confirmed that a second teenager had been arrested in connection with the inquiry on suspicion of possessing the Class B drug with intent to supply. It is the third arrest of the inquiry.
Ms Alford was arrested on suspicion of possessing cannabis, which she had kept overnight until the drugs were sent to a forensic laboratory.
Sir Brian asked whether the decision to arrest Ms Alford had been taken by the police officers involved or by the Crown Prosecution Service (CPS).
He also asked whether the case had been referred to either the DPP or the commissioner and asked why a reporter from another newspaper, who had been in possession of harder drugs, had not been prosecuted.
"Can you confirm that this is the case and, if so, what different policy considerations applied?" he said.
In a letter to Mr Jack Straw, the Home Secretary in charge of drugs policy, the Mirror alleges that Detective Chief Inspector Keith Gausden, who is heading the inquiry, made a telephone call to the CPS before arresting Ms Alford.