A man sentenced to a mental health facility for stalking actress Mila Kunis has been recaptured in Santa Monica, four days after he escaped from the institution, sheriff's officials said.

Deputies with the Los Angeles County Sheriff's Department's major crimes division took Stuart Lynn Dunn into custody in an alley about a half-mile from the beach, a sheriff's spokeswoman said.

Dunn pleaded no contest to stalking Kunis in January 2013. He was sentenced to six months of rehabilitation, five years of probation and ordered to stay away from the actress and her representatives for 10 years.

He disappeared on Saturday night from a mental health centre in Pomona, about 50 miles from where he was captured.

Authorities believe he got out of the Olive Vista Behavioural Health Centre by climbing through a bathroom window and scaling a barbed-wire fence. Officials went looking for him after he didn not return from a shower.

Authorities said Dunn had few contacts in the Pomona area so they focused their search on gathering places for transient populations. The area where he eventually was found is not far from such a gathering place near the beach.

Dunn was arrested for violating his probation.

"Mr Dunn's arrest was the result of the diligent efforts led by the Los Angeles County Probation Department's special enforcements operation and the Los Angeles Sheriff's Department's major crimes division," sheriff's officials said in a statement.

Dunn was arrested in February 2012 for breaking into Kunis' vacant condominium. He was taken into custody again months later after he waited for the star of Black Swan and That '70s Show outside her gym for three days, violating a restraining order.

Kunis was notified of his escape, and authorities said at the time he should be considered dangerous.