Charlie Sheen has been warned by a judge handling his custody battle with ex-wife Brooke Mueller that he could face jail if he violates a gagging order on the case.

Sheen has been vocal in his criticism of Mueller and the Los Angeles Department of Children and Family Services (Dcfs) over custody of the former couple's twin boys Max and Bob, but he has now been told he has to stop.

Sources close to the case tell Tmz.com the judge has imposed a temporary restraining order on the Anger Management actor which reinstates a gagging clause preventing him from commenting on the battle.

He is also banned from contacting Mueller or going within 200 yards (183 metres/600 feet) of her.

Sheen has slammed the Dcfs in a series of rants this week (beg04Nov13) for its handling of his children's custody, and Mueller tried to have the actor held in contempt of court after he spoke out about her drug problems in a filmed interview with Tmz.

Sheen and Mueller split in 2010 after two years of marriage but Mueller lost custody of the children in May (13) when she was placed on involuntary psychiatric care after a drug overdose. She is now seeking full custody after completing an outpatient rehabilitation program in October (13).