Mischa Barton's ex-boyfriend has been handed a five-year restraining order after he allegedly tried to sell sex tapes of the actress.

The 'OC' star had been embroiled in a revenge porn court case with her former partner Adam Spaw after he allegedly tried to redistribute tapes of the beauty.

And on Monday (27.11.17), their legal battle came to an end, with Adam agreeing to stay 100 yards away from his former flame for the next five years, as well as insisting he will not ''give away or assign in any way'' any photos or videos of Mischa.

Court documents obtained by The Blast state that both Mischa and Adam ''shall stay 100 or more yards away from each other, their residences, pets, vehicles, and places of employment, and shall have no contact directly or indirectly with each other through telephone, social media, texts and e-mails.''

The legal papers add that Adam has agreed ''not to directly or indirectly, or through any agent, sell, distribute, show, give away or assign in any way any intimate photos or videos of Mischa Barton. He further agrees that he has not to date done so nor attempted to do any of the foregoing.''

However, the documents also state that whilst Adam has agreed not to sell any media, the signing of the papers is not ''an admission'' to being in possession of any media involving the 31-year-old actress.

The documents claim: ''The signing of this agreement is not an admission by Adam that he possesses or attempted to sell any intimate photos or videos of Mischa Barton.''

It comes after the blonde beauty previously insisted she wanted to see ''real justice'' in her case.

She said in September: ''I'm going to see this case through to the end. I am very happy with what the judge has decided today. I don't think it's possible at this point to have seen it through long enough.

''I think that's important that we see real justice happen here with this case so I'm more happy that the judge seems to understand this type of case.''