Alex Kinyua
Alex Kinyua ate Kujoe Bonsafo Agyei-Kodie's heart and brains (Harford County Sheriff's Office)

A cannibal in Maryland has pleaded guilty to eating a man's heart and parts of his brain.

Alex Kinyua, 22, a former engineering student at the Morgan State University, killed Kujoe Bonsafo Agyei-Kodie, 37, before eating his organs in 2012.

Kinyua, who was originally from Kenya, admitted to murdering his victim. He denied criminal responsibility.

He stabbed the victim to death and carved up his body while Agyei-Kodie was staying with Kinyua's family on a visit from Ghana. Authorities said Kinyua had earlier spoken about human sacrifices on Facebook.

One message said: "Are you strong enough to endure ritual HBCU (historically black colleges and universities) mass human sacrifices around the country and still be able to function as human beings?

"It's been all too tragic with the dual university shootings at Virginia Tech and other past university killings across the country. Now for a twist: Ethnic cleansing is the policy, strategy and tactics that will affect you, directly or indirectly in the coming months."

Maximum security hospital

Agyei-Kodie's body was found four days after his disappearance in May 2012.

The judge said he had concerns about accepting Kinyua's plea but was bound by the psychiatrist's decision that the defendant could not be held criminally responsible. He was diagnosed with paranoid schizophrenia after the attack.

Kinyua was being held at Maryland's maximum-security psychiatric hospital.

In a separate case, Kinyua also pleaded guilty but not criminally responsible after he was charged with beating a man with a baseball bat on his university campus. The man was blinded in the assault.