Charlie Sheen in Court With Denise Richards

Charlie Sheen appeared at a court hearing related to Denise Richards' temporary custody of his sons with Brooke Mueller.

Both Richards and Mueller are ex-wives of Sheen, and each has two children with the actor, making the women unlikely friends. Mueller and Sheen's sons Max and Bob were placed in the care of Richards after the socialite sought treatment for drug addiction last week.

During Tuesday's hearing, Sheen and Richards appeared serious. According to a rep for Sheen, the "Anger Management" star fully supports Richards in lending a hand to Mueller.

"He knows Max and Bob are safe in a stable, loving environment with Denise and the boys' sisters," Larry Solters wrote in a statement, according to the Associated Press. "Charlie will fully cooperate and fully participate in all proceedings."

The 4-year-old boys were removed from their 35-year-old mother's Los Angeles home due to an "unsafe environment" and the allegation that Mueller was abusing prescription drugs, according to Yahoo! News.

Today, Mueller's whereabouts have been made public. The socialite's representative revealed that she was in UCLA Medical Center, and that is where she will stay until relocating "directly into a residential treatment facility to get help for prescription drugs abuse," reported E! News.

Richards, 42, was married to Sheen for four years until 2006 and shares daughters Lola and Sam with him. The actress also has a third daughter, Eloise, whom she adopted in 2011.

Alternately, Sheen married Mueller in 2008, but the pair divorced last year.

As for Richards helping to care for twins Max and Bob, an insider said the actress is more than happy to step in, according to Us Weekly.

"[Denise's] girls consider the twins their siblings," a source close to the actress revealed to the magazine. "This is their family and Denise would do anything for them."