Bloemfontein, South Africa (Sports Network) - Bongani Khumalo and Katlego Mphela scored to help South Africa edge 10-man France, 2-1, on Tuesday, but Bafana Bafana still became the first host nation to be eliminated in the group stage of the FIFA World Cup.

South Africa and France entered the game needing a win, for Uruguay and Mexico not to draw, and to overturn a huge gap in goal differential. South Africa was on track to completing the miracle equation with a two-goal lead, coupled with Uruguay's 1-0 edge over Mexico, but Florent Malouda scored France's first goal of the tournament to secure both clubs' exit.

Khumalo and Mphela scored in the opening half of the teams' Group A finale at Free State Stadium, and with Mexico losing to Uruguay, was within two goals of overturning the tiebreaker to advance. But Malouda's goal capped an otherwise forgettable World Cup for France, and secured berths in the knockout round for Uruguay and Mexico.

"Even though I think at 2-0 we should have killed the game off by scoring a third goal, I'm happy to have seen my players make progress. They've made the whole country proud," South Africa manager Carlos Alberto Parreira said.

South Africa finished even on points with Mexico, but ended third in the group on goal differential. France finished last in its group for the second time in its last three World Cups, ending a miserable spell for the French.

Uruguay held on to defeat Mexico, 1-0, in the other match in Group A Tuesday and finished first.

France had the first chance through Andre-Pierre Gignac inside three minutes, but South Africa goalie Moneeb Joseph made an easy save on the 10-yard effort.

Although France played well early, the match started to mirror the team's off- the-field issues in the 20th minute.

Khumalo fired Bafana Bafana in front in the 20th minute when he reached a corner kick from Siphiwe Tshabalala at the left post. Khumalo outjumped France defender Abou Diaby and headed into the left side from a few yards out for his first-ever international goal.

Mphela followed with another chance for South Africa in the 25th, but his long effort went just wide of the left post.

France's chances of ending the tournament on a good note crumbled five minutes later when Yoann Gourcuff got a straight red card for elbowing MacBeth Sibaya.

South Africa settled in with the man advantage and doubled its lead inside 40 minutes through Mphela. Tsepo Masilela created the goal, which Mphela merely had to tap in from a few feet out in the 37th minute.

France nearly made the game interesting in the closing minutes of the half but Franck Ribery's long free kick that had eyes for the right side of the net was barely pushed over the bar by Joseph.

Mphala ended the half with one last chance for South Africa, but Lloris pushed the ball wide of the left post to leave France within two goals at halftime.

South Africa's Bernard Parker started the second half by forcing Lloris into another save in the 49th, and Mphela nearly handed Bafana Bafana a three-goal lead two minutes later, but hit the outside of the right post following a nice set up by Steven Pienaar.

French veteran Djibril Cisse managed his lone chance on a dipping shot inches over the crossbar from 22 yards in the 55th minute, but was replaced by Thierry Henry just seconds later as coach Raymond Domenech searched for a spark.

Mphela's 30-yard blast forced Lloris to make a diving save in the 57th before Ribery created another chance for France in the 59th but fired over from about 16 yards.

South Africa continued to press for more goals to overturn its goal deficit in the tiebreaker against Mexico but Mphela and Pienaar had shots saved by Lloris as the match entered the final 25 minutes.

France ended South Africa's hopes of advancing in the 70th when Ribery set up Malouda to end the country's goalless World Cup. Ribery was played into space, and just before Joseph could reach the ball in the box, the French midfielder slipped a pass over to Malouda for an easy finish into an empty net.

Tshabalala ended the game with one last chance for South Africa in extra time, but Lloris kept out the close-range effort to deny the hosts another goal.

France exits the World Cup following a load of controversy, which started in qualification with the "Hand of Henry" goal in a playoff win over Ireland, and then an underage sex scandal involving Ribery. Nicolas Anelka was kicked off the squad a few days ago, then the entire team refused to practice on Sunday.

"We're sad and disappointed, even if I saw what I wanted to see in this match: selflessness, heart and solidarity," Domenech said. "When things aren't going well for you, they really don't go well."