Premier Mark McGowan has said social media companies should force users to use their real names to prevent anonymous trolling.

Speaking in response to racist slurs directed at West Coast Eagles footballer Liam Ryan on an Instagram post, Mr McGowan said the comments were disgusting and the "the sort of thing that should not happen".

Mark McGowan wants social media users to be forced to use their real names to prevent anonymous trolling. Credit:Richard Wainwright

The offensive comments were made in response to a thread discussing whether Mr Ryan should face a suspension.

Mr McGowan said there was a greater obligation on social media companies to prevent such comments after "recent events on social media", a reference to the role social media played in the massacre of worshippers at mosques in Christchurch.