Stephen Gough, the former soldier known as the Naked Rambler after repeatedly being arrested for hiking without clothes, has been sent back to jail after he failed to co-operate with social workers.

After again appearing in the dock naked, Gough was sentenced to five months in prison at Kirkcaldy sheriff court. Sheriff James Williamson lost patience with Gough for refusing to allow social workers to assess his mental health after he broke down during his last appearance in court.

Williamson told Gough, 53, a former marine from Eastleigh in Hampshire, that his failure to co-operate with social workers gave him no choice but to re-imprison him.

At one stage during the short hearing, the sheriff warned Gough, who appeared drawn but in control of himself, that he would be removed from court and sentenced in his cell because he initially refused to sit down for sentencing to conceal his body from the public areas of the court.

Williamson told Gough, who has spent most of the last six years in solitary confinement in Scottish jails after repeatedly being convicted of breach of the peace following complaints about his nakedness, that he had behaved with arrogance and self-indulgence.

On 20 July, Fife police had received several public complaints about Gough walking without clothes through Townhill near Dunfermline, only a few days after his release from Perth prison where he had completed a previous sentence for breach of the peace.

As senior officers had drawn up a new policy to try to compromise with Gough to avoid arresting him again, police suggested he change route over some fields to avoid a children's playground, or cover himself up and continue walking, or accept a lift from police past the playground on to a less public route.

Gough refused all three offers and was arrested. "That shows a degree of arrogance and disregard for the rights of other members of the public, in particular children, who have the right not to see naked men. Your self-indulgence has carried on. In these circumstances I have no alternative but to choose a custodial sentence," Williamson said.

At the first hearing at Kirkcaldy sheriff court three weeks ago, the judge had questioned whether Gough was showing signs of mental illness when he broke down in tears and appeared to be highly agitated and erratic.

Defending himself, Gough, who was heavily bearded and gaunt, had begun sobbing as he objected to prosecution allegations that his conduct was offensive and indecent. "There's nothing about me as a human being that is indecent or alarming or offensive. That's where I'm coming from, which is deep inside," Gough said.

He continued: "It's me, standing up for what I am. [Because] all of us are human beings too and we have children and our children are beautiful and we're beautiful too, because we're human beings – all the same. I have nothing to be ashamed about. I'm just a bloke standing up for the truth of what I am."

Williamson told him his behaviour raised doubts about his emotional and mental state. "I want somebody independent to see whether your mental health is all that it should be," he said, "because, in the absence of any good reason otherwise, you're going to end up serving prison sentence after prison sentence."

Shortly before Gough was sentenced, Brian Robertson, the depute fiscal, told the court that in 2007 Gough had agreed to, but then rejected, offers from the police to drive him home, then to an address in York.

The prosecution wanted to make the same offer again, Robertson said: "The authorities are prepared to facilitate his return home if his behaviour after the current case doesn't cause alarm to the public and necessitate his arrest."