Yesterday, he was re-arraigned on two other counts and pleaded guilty to possession of a Baikal 9mm automatic pistol and three rounds of .38 calibre ammunition at the same address on June 15, 2011.
He had pleaded not guilty to these charges at the beginning of the trial.
Mr Justice Paul Carney told the jury that they were now only concerned with the one charge of murder.
Eileen O'Leary, prosecuting, told the jury the accused accepted he had pulled the trigger.
She said he did not call assistance and hindered emergency services by locking the door.
Ms O'Leary said that the gun was placed at Mr Flanagan's neck, and the Deputy State Pathologist Dr Khalid Jabbar described it as an "almost hard contact".
She said the accused took steps to change his clothes and lied to gardai about his actions on the night of the incident, saying he had walked around for eight or nine hours.
Ms O'Leary told the jury the accused initially blamed the deceased for bringing the gun into the apartment but later admitted to gardai that he had it himself.
She submitted that there was evidence the accused murdered Mr Flanagan.
Patrick Marrinan, defending, told the jury it was a very unusual case with substantial problems.
He said the accused had admitted that he shot Mr Flanagan and that this case was not a 'whodunnit'.
Mr Marrinan said there was no doubt this was a homicide but it was whether it was murder or manslaughter.
He said the men were close friends and "this is where the bizarre nature of the case has alarm bells ringing that something is not right".
He said the gardai were completely baffled as to why the killing took place and that no motive was established.
Mr Marrinan said it was clear that a large amount of alcohol was involved and the men had been watching violent films.
He also asked the jury to recall the evidence they had heard from one of two other men present that night, Gary McMahon, who said told gardai: "I don't think he meant to do it, I think it was an accident".
Mr Marrinan told the jury there was a "huge hole in the case and nothing has been able to fill that hole".
He said there was no evidence of a scuffle or fight and that he was not satisfied that Donnelly intended to shoot his friend.
He asked the jury to find the accused not guilty of murder but guilty of manslaughter.
Mr Justice Carney was expected to address the jury later today.