Liam Stacey, the man accused of posting racially offensive comments on Twitter about footballer Fabrice Muamba, has admitted in court that he posted the comments.

Stacey, 21, pleaded guilty to a racially aggravated public order offence at Swansea magistrates court. He made the cruel tweet after Muamba had a heart attack during the game between Bolton and Spurs and was rushed to hospital.

Muamba is still critically ill in hospital although his condition is steadily improving.

Stacey, a Swansea University student from Pontypridd, Wales, was arrested after his comments were reported by the online community including prominent black footballer, Stan Collymore.

Among the comments on his Twitter feed, @LiamStacey9, were: "LOL. F*ck Muamba. He's dead!!! #haha."

The student had tried to claim the tweets were not sent by him and did not represent his views. He said his Twitter account had been hacked.

Magistrates were told he attempted to delete his Twitter account but was arrested on Sunday at his home.

During his interview with South Wales police, Stacey told police he had drunk a considerable amount of alcohol when he wrote the offending tweets.

He told police: "I was at the bar when I heard what had happened to Muamba. I don't know why I posted it.

"I'm not racist and some of my friends are from different cultural backgrounds."

Stacey was close to tears as evidence against him was read in court.

Magistrates heard he texted a friend and said: "I said something about Muamba that I shouldn't have and tweeted back to some people who abused me. Getting police on me now which isn't good at all."

Stacey has been bailed pending sentencing. He has been banned from Twitter and all other social networking websites.

A spokesperson for Swansea University said it had begun disciplinary procedure against him.