Six years ago, Naked Rambler Stephen Gough's hike from Land's End to John O'Groats brought him media fame – and a prison sentence. Then another, and another, and… why has he been locked up ever since?

Winter at HMP Perth. The river Tay carries slivers of ice on its journey past the prison wall. Prisoners' breath catches in clouds while they glumly circuit the courtyard. At this time of year, many choose not to take their allotted outdoor exercise. The stone corridors of A Hall sit silent; 133 men are in temporary lockdown while one of them is brought to meet me. To many of the prisoners this man is a stranger. They've got more chance of seeing his face in a newspaper than around the wing.

Stephen Gough occupies a parallel universe in HMP Perth. While the prison moves through its daily timetable, and other prisoners go to workshops or receive visitors, he remains alone in his cell. At 8.30pm, when the building is locked down for the night, he is released for 30 minutes. He empties his rubbish, posts his letters and has a shower. If he's lucky, he also has time for a walk, a quick circuit of the empty corridors.

This morning Gough, 52, is on his way to meet me, so the rest of A Hall wait behind their doors. He's led from his cell, along the walkway, down the stairs. I hear his bare feet padding across the stone before he turns into the office.

"Nice to meet you," Gough says politely.

We shake hands and for a moment he's unsure where to sit. With the dutifulness of a long-term prisoner, he stands awaiting instruction. His body is pale and lean, patched with strands of brown hair. His penis dangles in the cold air between us.

The media call Gough the Naked Rambler. He's serving 657 days for a breach of the peace and contempt of court. The breach was leaving HMP Perth naked after finishing a previous sentence. He was taken to Perth sheriff court, and represented himself naked. That was the contempt. When he returned to the prison, the cell was just as he'd left it – he hadn't bothered to pack.

Gough's latest conviction is his 17th in 10 years. Since May 2006 he has been in a run of short sentences broken by the same fleeting freedom: he's effectively been in custody for nearly six years for refusing to get dressed. At a recent hearing, it was suggested he could be in prison for the rest of his life. "People often have to go to prison for many years," he said, "before others see the light."

I ask how he is. "Well, you know. You adapt."

So how did an intelligent, likable, earnest man come to forfeit his liberty for his right to be naked? After a spell in the Royal Marines, and a dalliance with the Moonies in Thailand, Gough spent nearly 20 years in his native Eastleigh, Hampshire. He worked as a lorry driver and got involved with environmental groups and communal living. Then, in 2000, aged 40, he moved to Vancouver for a year with his partner and their two children.

"I wasn't working in Canada," Gough says. "I spent my time looking after the kids and going for walks. One day I was walking and something happened." He had an epiphany: "I realised I was good. Being British, buried in our upbringing is that we're not good or have to watch ourselves – maybe it comes from religion, or school. I realised that at a fundamental level I'm good, we're all good, and you can trust that one part of yourself."

This self-realisation led to Gough often choosing to be naked in public: if he was good, then his body was good. "The human body isn't offensive," he says. "If that's what we're saying, as human beings, then it's not rational."

His former partner was "more conservative" and a visit from her parents proved calamitous. "One morning I came to breakfast naked and that was it, all over," Gough says flatly. "The thing was, her parents weren't even that bothered."

The couple returned to Eastleigh together, but Gough went to live with his mother. He arrived back in England, he says, with an intense appreciation of what nakedness could offer, and questioning "things we're taught to believe are right". He visited a police station in Eastleigh and asked if it was illegal to walk naked in the streets. "They couldn't come up with an answer," he says.

His first naked walk was short-lived. In January 2003 he left his mother's home and headed for Eastleigh town centre. "Nothing really happened," he says. "There was one man who shouted, 'That's disgusting!' but he was eating a sandwich so I think that's why. I was about to go into the covered market when the police arrived in a big rush."

By his court hearing, he'd been adopted by various naturist groups. The BBC reported that he emerged naked to "a crowd of supporters". Photos show a muscular, healthy Gough beaming on the court steps. "I wanted to follow my truth," he recalls, "to keep asking questions."

That summer, Gough set off from Land's End wearing hiking boots and a rucksack. His planned destination was John O'Groats. On his first day the Cornish press ran jovial reports. On his second he was arrested in St Ives, held briefly, then released. On the town's outer fringes, he was brutally attacked: "A couple of guys pushed me over. They kicked me in the head and did this." He points to his skewed nose. "I thought, is this what it's going to be like? But actually that was the only real problem I had until I got to Scotland."

On his journey through England, skirting towns and sleeping rough, Gough was stopped "every so often" by the police. He'd put on clothes and explain what he was doing. Bemused officers, he says, would turf him out of stations "on the sly, out the back door". Someone in the legal system who does not want to be named later tells me that English police would sometimes quietly drop Gough off just over county lines.

In Scotland, however, he met more determined opposition. In the north-eastern corner he was picked up several times by police and finally convicted of breach of the peace. He served four months in HMP Inverness, an experience he found "actually quite good". It was his first taste of segregation. "I flourished and found out more about myself. You do that in extreme situations."

On his release, Gough launched a final push for John O'Groats. He was a few days from Britain's northern tip when a car stopped and a man jumped out. "He said he'd read about me and had been looking for me for days. He had a flask of soup and cake, and wished me luck." Gough reached John O'Groats on 22 January 2004 and the media were waiting. He posed for jaunty photos at the iconic signpost and local hotel staff gave him a bottle of champagne. "It was a great feeling," he says. "I thought it was the end."

Gough returned to Eastleigh, bought a van and headed for Studland, a Dorset village popular with alternative lifestyle enthusiasts. He tried to write a book about the walk, but was beset by a nagging doubt: "I kept thinking I'd been compromised. Why did I put on clothes when the police stopped me? That was wrong; it defeated the whole point."

The doubt grew until it had to be faced down. He would make the journey again, this time "without compromises". With his new girlfriend, Melanie Roberts, he set off from Land's End in June 2005.

If anything, England was even easier this time around. Photos online show Gough and Roberts naked in pubs amid grinning drinkers and shopping unclothed in supermarkets. Dealings with police were no more than an irritation. "They'd ask what we were doing, we told them and that was usually that," Gough says.

Again, it was in Scotland that he ran into trouble. "We got nabbed in Edinburgh," he says. "And I was getting a bit hardcore then."

By hardcore, Gough means he refused to get dressed for court and pleaded not guilty to breach of the peace. Roberts, on the other hand, got dressed, pleaded guilty and stayed in a hostel while Gough served two weeks in Saughton prison.

Did that cause tension between them? "People have to do what they want," Gough says. "I'm for freedom, so I accepted her decision."

They resumed their walk amid growing media interest. A documentary team caught footage of Gough and Roberts being led through a village by a piper. Yet what Gough remembers as "a carnival atmosphere" led to further problems. While many Scottish police had decided to ignore Gough in the past, his spreading fame made that more difficult. For the police, critical mass was reached when he once more entered the final stretch of his journey.

"They nabbed me again," Gough says simply. "Back in Inverness prison. Another five months."

Gough and Roberts reached John O'Groats in February 2006. Once again, he'd finished his journey in the coldest months of the year. "Pretty cold but manageable," he says defiantly, insisting temperature is an issue only "when you stop, as that's when you start seizing up. The trick is to keep going." Local journalists reported Gough and Roberts walking stoically through "lashing rain".

The two would sleep fully clothed in their sleeping bags, Roberts says. "When there's snow on the ground, it's hard to get out of your sleeping bag, let alone your clothes, to do a 22-mile walk."

They made some allowances for the weather. "We wore warm hats, thick socks, gloves and walking boots," Roberts says. "We ate lots of carbohydrates and walked fast. The closer we got to the finish, the easier it was to forget the cold and pain."

"There were fewer photographers," Gough says of his second arrival at John O'Groats. "And the champagne the hotel gave me was a miniature."

He returned to Roberts's native Bournemouth with court dates that meant he would have to go back to Scotland, and with a relationship that, away from the unique atmosphere of the walk, was no longer working. "She sensed the cause meant more to me than her," Gough says.

"It was very sad," Roberts recalls. "Steve knew he would be going to prison for a long time. We finished the relationship before he got on the plane. I worried for him, but I knew he'd suffer if he didn't follow what he feels is true and right."

On 18 May 2006, a fully-clothed Gough boarded a 6.45am flight from Southampton. After the pilot announced the descent into Edinburgh, Gough visited the toilet and emerged naked. "I knew I wanted to go to court naked and I suddenly thought, why not now? The flight attendant asked if I'd put my clothes back on. I said politely that I wouldn't and she went away. Nothing happened until we landed and the police came on."

Gough was arrested. His solicitor at the time, John Good, describes a court hearing not far short of slapstick. It emerged that after Gough returned naked from the toilet, the male passenger sitting next to him reacted by falling asleep. The arresting officer's only issue in removing Gough from the plane was the delighted reaction of a hen party. For Gough, however, his midair strip meant a four-month sentence. He has been in prison ever since.

Gough isn't mad. "They do evaluations all the time." He smiles. "I'm on top of my game mentally. I've got clarity. If I feel down, then I'm straight on the case, trying to work out why."

He emerged from more than two years of segregation with faultless psychological examinations. "If you or I spent two years in segregation," Good says, "we'd probably show signs of trauma. It just shows how focused he's become. He's immune to his surroundings."

Gough agrees: "I live at a deep level." Yet he admits to experiencing doubts about his stance. "Yeah, of course. I wake up in the morning and think, what the fuck am I doing here? But what I'm doing isn't about me. I'm challenging society and it must be challenged because it's wrong."

In Scotland, breach of the peace is partly defined as "conduct which does, or could, cause the lieges [public] to be placed in a state of fear, alarm or annoyance". The prosecution has very rarely managed to rustle up witnesses to claim Gough's nakedness has had any of these effects on them. What is keeping him in prison is simply the theoretical idea that it could.

"I do not believe that an ordinary, reasonable person would feel any of those things if they saw me [naked] in the street," Gough says. He believes that to achieve his stated aim – to leave HMP Perth and return to Eastleigh naked – "the law doesn't have to change, just the interpretation".

Twice Scottish sheriffs found in Gough's favour that no crime had been committed, both in him being naked in public and being naked in court. "Both times the sheriffs were elderly females," notes Good, who represented Gough for more than three years (they parted company in 2010 so Gough could represent himself, making it harder for him to be excluded from the courtroom for being naked). "Stephen then chose to leave court naked and was arrested for being naked in public."

Initially, Gough was a legal novelty in Scotland and support came from surprising quarters. In 2008, Edinburgh-based solicitor Joe MacPherson prosecuted Gough, a position with which he says he was uncomfortable. "I looked at the case and thought a man walking down a public street would not cause the requisite fear and alarm to an ordinary person. It would be odd, or amusing perhaps, but nothing more. The judge said his hands were tied. Seeing a man's penis was felt to be enough to cause fear and alarm."

Eventually Gough's case was heard at Scotland's appeal court, where it was found that breach of the peace should indeed be interpreted to criminalise his behaviour. Since then Scottish sheriffs have fallen in line; his sentences have steadily increased to the maximum and, should he keep refusing to dress, he will be caught in an endless cycle of two-year sentences. He insists if he were allowed to return home naked to Eastleigh, he'd cease being naked in public "when I don't have to do it any more".

The courts, prison and police are left to attempt a solution. "Mr Gough is asked every morning if he is willing to get dressed and take part in the daily regime," a spokesman for Perth prison says. "This he refuses. Due to his refusal to wear clothes, we cannot move him around the prison, meaning all services come to him in his cell." Gough, he says, has never complained about his bedding or heating, and they work around his "unique and problematic" position.

"I put a quilt over my shoulders at night," Gough says. "That's not a contradiction because there are no restrictions on me when I'm alone in my cell. It's in public I'm restricted and go naked as a result. Even with the quilt it gets pretty cold, but exercise helps."

Chief inspector Andy McCann of Tayside police, whose officers frequently rearrest Gough in the prison car park, says, "We have had and continue to have discussions with Mr Gough to seek a compromise position. We've suggested transferring him to an English prison, or transporting him upon completion of his sentence, but these have not been acceptable arrangements to him."

Gough wants to walk out of HMP Perth and make his way home to Eastleigh naked. Anything else is dismissed as a "compromise". He's due for release in the summer. Will he again walk out naked, and into an inevitable further sentence?

"Yes, yes." He nods firmly. "That's my position."

So we're back to the beginning – a 52-year-old man threatening to sacrifice his freedom on a point of principle that, although logically coherent, is also utterly frustrating and has cost him his relationship with his two teenage children. He writes to them without reply.

"If I had a dad that was doing this, I'd probably be confused," he says. "I'm guessing as they grow up, and learn more about how life is, they'll come over to my way of thinking. I'm thinking long-term." His former partner is "angry that I'm not seeing my kids – but so am I".

He hasn't heard from Roberts for a while, though she tells me she is strongly supportive of his stance. "He's vindicating the right of the individual to be individual," she says. "For me, Steve's a hero."

The naturist groups that once gathered outside courts to cheer him are long gone. His mother is 85 "and not so well". Ten years ago, she found his nakedness amusing. "She thought of it as a funny British thing, like Monty Python playing the piano naked. Now she doesn't really get why I'm still here." He has no support, no money, just his belief.

After two hours of conversation, Gough's nakedness has faded to insignificance. He's a magnetic presence, relentless in his storytelling, the speed of his voice fluctuating as it struggles to keep up with his thoughts.

He tries to reposition the loneliness he feels, to tell himself "the connection" with others he misses can somehow be found within his own mind. Yet he admits to having an overriding wish to "have a meaningful conversation with someone. I have to catch myself," he says, "and make sure I don't become melancholy."

He writes to supporters around the world and seizes on interaction when the opportunity arises. "My threshold for small talk is higher than it would otherwise be." He laughs. "The other night I had a long conversation with a prisoner mopping the floors about my favourite type of flapjack." When he does have brief encounters with the other inmates, he says he feels "an instant camaraderie. We're all enduring privations and going through hardships together."

What he misses most about clothes are pockets ("Somewhere to put my hands"), and his nakedness forces him to see the varicose veins on his legs, "which I don't like". He prefers to position his struggle on a higher scale, but sometimes the constant need to account for his behaviour can be unbearable. Good describes occasions in court when Gough broke down entirely. "He'd be asked to explain his position and it meant so much to him to get it right that he couldn't do it. He'd choke, start sobbing."

When I ask Gough for a final summary of his standpoint, he says, "Truth and freedom are difficult concepts to understand. They can't be grasped by the mind."

When Gough poses for the photographer, he doesn't move like a naked man. He's stiff-backed and lithe, stamping his hardened feet on the ground. This is a man who has been naked for nearly six years. It's strangely difficult to imagine him clothed. The photographer asks him to place his hands on his body. Gough politely refuses, explaining that this would be just another form of covering up, of chipping at the purity of his position. Instead he stretches his arms and puffs his chest, framed against the winter's light.

Two days after my visit, I receive a long letter from Gough expanding on the reasons behind his stance. It's an extended, meandering manifesto broken by moments of sharp insight. He concludes: "We can either end up living a life that others expect of us or lives based on our own truth. The difference is the difference between living a conscious life or one that is unconscious. And that's the difference between living and not living."