Mel Gibson's lawyers just got a judge to order Oksana Grigorieva's bodyguard/key adviser to stay away from baby Lucia ... TMZ has learned.
Judge Scott Gordon issued a restraining order against Oksana's confidante, Kristian Otto Herzog, after Mel Gibson's lawyers claimed he's a danger to Mel's daughter.
As we first reported ... Herzog is has a long rap sheet -- each case involving firearms. He was released from jail in March after serving 255 days. He is currently on probation.
We're told Mel had asked Oksana to keep Herzog away from Lucia ... but she refused. So today Mel's lawyers asked the judge for a restraining order ... which has been granted.