How I Met Your Mother star Josh Radnor has been told to stay away from his neighbors after they complained about him harassing them while shirtless.

The celebrity has been embroiled in a dispute with Scott and Janice Anderson, who live next door, since last year over the construction of a large deck on his property in the Hollywood Hills.

In the most recent court development, the family asked a judge for a restraining order which means Radnor must stay away from them. He has been told to keep a distance of at least seven yards at all times.

Josh Radnor, 44, has been told to stay away from his neighbors after they complained that he had been shouting at them, sometimes while shirtless, in an ongoing dispute over his backyard deck

The Andersons' home is pictured, left, and Radnor's is shown, right. In between them is an easement which they say is theirs and which grants him access to his deck

They say that since a judge sided with them in their complaint that he did not have the proper permits for the deck, Radnor has been making their lives difficult.

They allege in court documents obtained by DailyMail.com that he not only shouts at them whenever they go outside but that he also makes workers in their yard 'uncomfortable'.

Radnor's representatives did not immediately respond to DailyMail.com's inquiries on Friday morning.

The dispute began in May 2017 after Radnor built the expansive deck.

Radnor and his neighbors have been in dispute since 2017. He bought his home for $1.1million in 2007

One of the neighbors' complaints is that Radnor appears on his deck shirtless and yells at them

According to court records, the prior owner of his home acquired the right to expand the yard into the neighbor's land but only if they kept a walkway and a wall that were there.

In 2016, Radnor built his deck but demolished the wall, according to his neighbors.

He claims in court records that they have since climbed over a fence to sit on the deck without his permission, something he says is 'distressing'.

He wanted his own restraining order to apply to them.

Their lawyers claim that because the deck is on their land, they have a right to occupy it.