He then drove it a short distance to the Flax Foyer Building where it was hidden behind a fridge.

The 48-year old, from Northwick Drive in the city, pleaded guilty to possessing the gun with intent to endanger life.

He was told he will serve six years in custody with a further six years spent on supervised licence upon his release.

The court heard McWilliams had a "relevant record for terrorist offences" and was sentenced to life imprisonment in March 1995 for murder. He was released on licence in July 2000, and subsequently had his licence revoked by the secretary of state.

Appearing alongside McWilliams in the dock was 59-year-old Michael Joseph Gorman, from Estoril Court in Belfast.

Gorman - who also served a life sentence for a terrorist murder and was released on licence in December 1995 - pleaded guilty to assisting an offender.

He works at the Flax Foyer and let McWilliams into the building, where the weapon was concealed for a short time. For his role, Gorman was handed a five-year prison sentence, suspended for five years.

A senior prosecutor told a judge that serious street disorder erupted in the area on 12 July, 2012 after an Orange Order parade passed the Ardoyne shop fronts. During the riot, police were pelted with missiles including bottles, stones, petrol and blast bombs.

At around 00:20 BST on 13 July, a gunman emerged from the crowd and discharged 14 shots in quick succession at police in the Brompton Park area.

The prosecutor told the court: "Fortunately neither the police vehicles nor the officers were struck by any of the shots."

A police helicopter equipped with CCTV recording technology recorded the gunman withdrawing back into the crowd.

He then made his way to a parked Citroen and was seen putting the weapon in the rear of the vehicle before walking away. The gunman has never been apprehended.

The Citroen was then driven by McWilliams to Flax Street, and when he arrived at the Flax Foyer building - which provides accommodation to young people - he took a holdall from the back of the car.

CCTV turned off

The prosecuting lawyer said Gorman let McWilliams into the building around five minutes after the shots were fired, before the holdall was left behind a fridge in the kitchen.

When police later seized CCTV footage from the building, it emerged that cameras had been turned off for most of the period of time when McWilliams was in the premises.

It was deactivated for a second time from around 00:41 BST to 00:50 BST, which is when the Crown believe the weapon was removed from the building, as it was not recovered during a subsequent police search.

Both McWilliams and Gorman were arrested, and during interview both men denied being members of a proscribed organisation.

McWilliams initially denied involvement and gave "no comment" answers, while Gorman told officers he had been threatened and was told to turn off the CCTV system.

Passing sentence, a judge told McWilliams: "You have shown absolutely no remorse and the only thing that you are concerned about is yourself and your family."