He achieved the qualifying standard for the 1500 m and 800 m and was entered in both races at the 2012 Summer Olympics. He reached the 1500 m final after winning his heat and semi-final. The Algerian Olympic Association had failed to withdraw him from the 800 m event, which he no longer wished to compete in, and he was forced to enter the race. Makhloufi slowed and dropped out in the early stages of his 800 m – a performance that led to him being disqualified from the Games as the IAAF referee "considered that he had not provided a bona fide effort". However, he was re-instated after producing an independent medical certificate showing that an ailment had hampered his efforts. The following day, Makhloufi won the 1500 m Olympic final with a time of 3:34.08 minutes, clocking the last lap in 52.76 sec defeating among others the reigning Olympic champion Asbel Kiprop. This performance surprised critics given his previous medical statement and the quality of the field. Makhloufi explained that his improvements stemmed from a change of coach and his intensive training that year.