A 52-year-old man shot another man as he was sitting on a sofa in his apartment watching a film two years ago, the Central Criminal Court has heard.

Peter Donnelly of The Green, Larch Hill Apartments, Santry, Dublin, has pleaded not guilty to the murder of Edward Flanagan and possession of an automatic pistol and three rounds of ammunition in June 2011.

Mr Flanagan was found shot dead at Mr Donnelly's apartment on 16 June 2011.

Mr Donnelly pleaded not guilty to murder as his trial began this morning.

Outlining the case, Senior Counsel Eileen O'Leary said four men were drinking cans of beer in a field at the back of Belcamp College in Coolock before going back to Mr Donnelly's apartment.

They continued drinking there while watching films in the living room, but a dispute arose.

The court heard that Mr Donnelly left, came back with a handgun, walked around the back of the couch, and shot Mr Flanagan in the back of the neck.

Neighbours heard the shots and called gardaí.

The first garda could not get in, but the door to the apartment was forced open after he leaned over a neighbour’s balcony and saw Mr Flanagan slouched on the couch with a can of beer in his hand and what appeared to be blood coming from his head.

The jury of seven men and three women was told that later that morning, Mr Donnelly voluntarily went to Coolock Garda Station and told gardaí he discharged the gun that shot Mr Flanagan.

He denies the charges of murder and possession of a Baikal 9mm automatic pistol and three rounds of .38 calibre ammunition.

The trial is expected to last a week.