Wales suffered Rugby World Cup heartbreak after captain Sam Warburton was sent off in a controversial and dramatic semi-final showdown with France.

Warren Gatland’s men played for over an hour with 14 men after Warburton was dismissed for a dangerous tackle on France wing Vincent Clerc, but they still came agonisingly close to victory.

Mike Phillips’ try brought them back from 9-3 down before Leigh Halfpenny’s halfway-line penalty slid just under the crossbar with a few minutes remaining.

France were poor but Morgan Parra landed all three of his penalty attempts while James Hook missed two and Jones failed with his conversion attempt.

In the end, Wales’ dream of a first World Cup final appearance died with a knock-on and France, who dispatched of England last week, will face either New Zealand or Australia in next Sunday’s final.

Warburton’s dismissal was the talking point of the match and referee Alain Rolland was booed from the stands and widely criticised for his decision.

But the Irish referee – whose father is French – applied the letter of the law after Warburton had tipped Clerc in the tackle with 62 minutes still to play.

It was only the second time a player has been sent off in the knockout stage of the World Cup and on the other occasion it was also a Welshman, Huw Richards, who saw red for fighting against New Zealand in 1987.

Before the dismissal of Warburton, Wales had also lost influential tighthead prop Adam Jones to a calf injury, but they responded superbly and had the outstanding players on the field in Jamie Roberts, Toby Faletau and Phillips.

The final statistics made for remarkable reading. France, with their full complement of men, were forced to make 126 tackles to Wales’ 56 – but all they have to show for it is a chance to equal their best-ever finish of third place.

Hook had been given the nod to start after Rhys Priestland was ruled out through injury and he began the game in confident fashion.

The fly-half picked out wing George North with a cross-kick, Faletau drove it forwards and Thierry Dusautoir was spotted offside. Hook landed the kick from near the left touchline to put Wales ahead before disaster struck.

First, Jones went off to be replaced by Paul James and immediately the Welsh scrum drew a penalty but Hook slipped as he struck the ball and pulled his kick. And their promising start was punctured when Warburton was shown red. The decision, correct under the letter of the law, was greeted by boos.

France drew level with Parra’s penalty and he nudged France into the lead after Hook had missed a second kick for the Welsh .

France briefly upped the tempo after the interval and Stephen Jones was sent on for Hook, who had also missed with a drop goal attempt, after 45 minutes.

Parra extended the lead to 9-3 but Stephen Jones’ raking clearance and a strong chase earned Wales a prime attacking platform. Roberts and then Faletau carried Wales forward before Phillips attacked the blindside, beating both French locks to score and bring Wales storming right back into the game.

The game seemed theirs to win as they dominated the closing stages but Stephen Jones fluffed one drop-goal attempt and turned down the chance of another as he tried to carry the ball, only to spill it in the tackle.

A final opportunity arrived when Nicolas Mas was penalised on halfway, but Halfpenny’s long-range strike slid agonisingly under the bar and a final attack, containing over 25 phases, failed to draw an error as the French defence held firm on their own 10-metre line.

Wales’ Jonathan Davies is dejected after his side’s agonising defeat Photograph: Anthony Phelps/Reuters