For more than 100 years Cardiff market has been a gem of the capital.

The historic market is a place where you can pick up almost anything you'd ever need and see a load of characters along the way.

But the site was once home to something far more notorious - the infamous Cardiff Gaol that housed hundreds of prisoners for more than 300 years.

The entrance at St Mary Street in 1975

The original court and jail in the city was located within the walls of Cardiff Castle that lasted up until the 16th Century.

However, with the castle beginning to show its age and there not being much space for the growing prison population, a new jail was built right in the heart of the ever-expanding Cardiff.

For the next few centuries it would be the site of dozens of public hangings and home to criminals.

In the 19th Century, 19 men and one woman were hanged within the jail.

Documents from one execution even reveal how much the hangman was paid.

Inside the market in 1965

Accounts at the Glamorgan Archives of one of the jailers showed that a hangman was paid £4 and four shillings not including an extra 15 shillings for "ale and punch".

The most famous and controversial execution was the hanging of working class martyr Dic Penderyn, a labourer involved in the Merthyr Rising of June 1831.

Despite serious doubts over Penderyn's role in the stabbing a soldier during the riots, he was found guilty.

At 8am on August 13 in 1831, Penderyn was hanged outside the jail at what is now the St Mary Street entrance to the market.

The last words of the 23-year-old were "Oh Lord, here is iniquity".

Dic penderyn
Young collier Dic Penderyn was accused of stabbing a soldier during the Merthyr Uprising

More history stories from WalesOnline

In 1980, a plaque was placed at the St Mary Street entrance to the market by the National Union of Mineworkers to commemorate his death.

The plaque reads: "The county gaol stood on this site for over three hundred years and it was the scene of brutal punishment and religious and political martydoms".

The jail featured heavily in newspaper reports throughout the 18th and 19th Centuries.

One from February 1857 revealed that the governor of the prison requested that no more prisoners were sent to the hail as there were "already upwards of 152 occupying the room originally built for 60".

The modern day HMP Cardiff

In 1814 the jail was considered "inadequate" for coping with the city's rapidly growing population.

Proposals were made to build a new county jail, and land was bought south of Crockherbtown.

Construction of the new prison started in 1827 and the new Cardiff prison opened towards the end of 1832.

The prison was capable of holding 80 inmates across three wings. The prison took over the role of county jail duties, but the older site on High Street continued to be used as the town jail.

After the Home Office took over responsibility for prisons, the jail finally closed in 1877 before being demolished.

Cardiff Market then opened in May 1891.

For more than 120 years it has served the city - and was made a Grade II listed building in 1975.

Wonderful photos showing the 120 year history of Cardiff Market