DEPRIVED of one's liberty, detained at Her Majesty's pleasure, incarcerated, imprisoned, in stir, in jug or in the slammer, doing time, bird or porridge, banged up, sent down.

Whether you use the prosaic language of officialdom or the colourful Petticoat Lane argot of Del Boy, the net effect is the same: the long arm of the law has caught up with you and you are in for a stretch behind bars.

In the bad old days you might have served your sentence in Ripon prison and house of correction, a grim set of buildings just below the city car park with all the external visual qualities of the Bastille, Durham jail and Newgate rolled into one.

These days the only block still open to the public may be nothing more intimidating than a prison and police museum on the city tourist trail, but once you go beyond that heavily barred front gate you still get the feeling that it may be a long time before you see daylight again.

Some modern prisons have been cynically portrayed as holiday camps in certain sections of the media - Jeffrey Archer was once supposedly destined to be transferred to the "Savoy of slammers" - but the institution in St Marygate, Ripon, would never have qualified for this dubious honour.

Petty offenders convicted under the vagrancy, game or bastardy laws were usually sent to this establishment, but even the most incorrigible among them must have found it a soul-destroying experience in the 1840s. Punishment was paramount and rehabilitation of offenders was unknown.

The general social tone of things in centuries past can be deduced from the moment you step into the tiny front yard, where stocks, a pillory and a public whipping post have been preserved as reminders of the humiliation meted out to miscreants whose offences now seem relatively minor.

From there you pay your money at the desk and follow stone steps and corridors into a chilling world where comfortless cells and suitably dressed mannequins evoke an era of hard labour involving the treadmill, the crank, oakum picking or breaking stones.

The figures tell the story as much as the surroundings. Those in uniform carry an air of straight-backed, unforgiving authority while the subjugated ones in drab prison clothing sit resignedly on hard beds.

Themes to be found among the words and pictures making up wall displays include transportation and prison ships, a fate imposed on many thieves who might have found the ultimate death penalty more merciful - the role of the Ripon Wakeman in safeguarding the city and the history of fingerprinting, a new feature this year.

The museum is in the 1816 prison extension to the house of correction, work on which had begun in 1686 in response to the threat presented by gangs of aggressive beggars who roamed the countryside and the city.

Inmates were transferred elsewhere when the St Marygate buildings were closed in 1878 but they continued to serve the interests of justice. The old West Riding police force established a presence there and continued to use the cells until a new station was opened in North Road in the 50s.

Perhaps it is no coincidence, then, that retired policemen such as Mr Derek Gowling and Mr Ralph Lindley are among volunteer staff at the museum, which became established during Mr Kenneth Henshaw's reign as chief constable of North Yorkshire.

The house of correction and old police office had passed into private hands, leaving the prison wing empty, when Ripon civic society and Ripon museum trust established a separate charitable organisation almost 20 years ago to work towards developing the museum.

From its inception in 1968, the civic society had felt strongly that the small museum behind the Wakeman's House was inadequate to illustrate the history of the city.

The first phase of the prison and police museum, developed in the old night cells on the first floor, was opened by Mr Henshaw in 1984. Later that year the building was bought by Harrogate council, which granted the museum trust a long lease. The second phase on the ground floor was completed in time for the Ripon 1100 celebrations in 1986.

Restoration work was done mainly by volunteers and young offenders from Northallerton youth custody centre and partly financed by grants from local authorities and the Yorkshire museums council.

Mr Henshaw arranged for the long-term loan of official North Yorkshire police artefacts and these, along with items lent by Mr Lindley from his private collection, made up the exhibits at the opening in 1984.

But the museum contains only a third of the historical detail to be found in a well-rounded story of policing, justice and welfare in Ripon, being on a law and order trail which also takes in the workhouse in Allhallowgate and the former courthouse in Minster Road.

The workhouse museum, opened in 1997 in buildings owned by the dean and chapter of Ripon and still the only one of its kind in the country on its authentic site, presents a poignant picture of life before the modern welfare state.

Delousing, a meal of bread and gruel and nights on a narrow iron bed in one of 14 cells only a few feet square awaited anyone who fell on hard times. There were prayers and compulsory silences and those who could work chopped wood or broke stones.

Education had its part to play, though, and the workhouse experience has been extended this year with the addition of a Victorian schoolroom display using memorabilia from Copt Hewick school, near Ripon.

A new dimension has been bestowed on the 171-year-old courthouse, the closure of which in 1998 prompted one local magistrate to resign rather than travel to sittings at Harrogate.

Rather than leave the building as a soulless empty shell, the museum trust has arranged for it to be populated with board cut-outs of magistrates, a defendant, a policeman and local dignitaries carrying the halberds which regularly led processions at the start of quarter sessions.

Dr John Whitehead, president of the museum trust, set up the prison and police museum and was its first curator. He said: "From the comments we get in the visitors' book they think that perhaps our forefathers got it right as far as prisons are concerned, but at the workhouse they are fairly well horrified."

He added: "The memorabilia from the village school at Copt Hewick consisted of such valuable and quite impressive artefacts that we decided to set up the exhibition."

All three museums are open daily from 1-4pm in September and from noon-3pm until Sunday, October 28 (11am-3pm during school half-term in October), after which they close until next Easter.