A man accused of shooting his wife and posting a picture of her dead body on Facebook is defending a murder charge in court.

Graphic footage of an argument Derek Medina had with his wife, Jennifer Alfonso, in the moments before her death has been shown to a jury in a Florida court this week.

It is understood the footage came from an elaborate home security system.

The video shows the pair arguing in the kitchen of their South Florida home in August 2013.

Medina is seen entering the kitchen while Alfonso washes dishes. It is believed the couple argue at this point, and Medina exits the kitchen, returns, then a flurry of gunsmoke swirls in the air. The couple are off-camera when the shooting occurs.

Medina is then seen exiting the kitchen, but returns with what appears to be a mobile phone.

A picture of his wife’s dead body was posted on his Facebook account that day, alongside a message indicating he had killed his wife.

“RIP Jennifer Alfonso.”

Another message about her death also appeared on his page that day.

“I’m going to prison or death sentence for killing my wife. Love you guys, miss you guys, take care, Facebook people will see me in the news. My wife was punching me and I am not going to stand anymore with the abuse so I did what I did. I hope you understand me.”

The image and post sent shockwaves across the world and Medina was swiftly incarcerated — held in the psychiatric ward of Miami-Dade County Jail on suicide watch.

He is now on trial on the murder charge, arguing the couple were fighting before his wife died, and he killed her in self-defense.

If he is convicted of first-degree murder, he will likely face life in prison.