The #REPRESENT campaign is created to encourage people to leave messages of support for the British Athletics team, which in turn generates pictures of athletes holding boards showing the name the person submitted.
However, several users saw it as an opportunity to post offensive messages, including about Madeleine McCann and Jimmy Saville (see below), which were then put onto the pre-shot images of top athletes.
These messages have since been removed.
The National Lottery was forced to apologise via Twitter, saying in two tweets sent early on Tuesday morning: "We are aware that some people are maliciously targeting our British Athletics Twitter campaign with offensive and abhorrent content.
"We are dealing with this as quickly as possible and are hugely sorry for any offence caused by this malicious act."
So this was a poor plan @TNLUK #REPRESENT pic.twitter.com/MjvtPYrVBi
— Jody Jamieson (@jodyjamieson) August 14, 2017
The campaign echoes another earlier this summer by Walkers Crisps, which was hijacked in a similar way.