CARDIFF, Wales (AP) — The Springboks came back. Allister Coetzee wants to as well.

Except, the South Africans ended up losing to Wales 24-22 in their rugby tour closer on Saturday.

And coach Coetzee is expected to lose his job, too.

The Springboks fought back from 21-3 down to lead for the first time at 22-21 with 15 minutes to go. Then Wales fullback Leigh Halfpenny kicked a penalty from a ruck offense with 12 to go, but errors by both teams prevented them from finishing the other off.

After Pieter-Steph du Toit was turned over by Wales captain Alun Wyn Jones and fulltime came, Coetzee jerked back in his chair in anger and stormed off the coaches' bench. But even if the Springboks had won a third straight test on their European tour, he's still not expected to survive a review this month.

Despite improving on a pitiful four wins last year with seven this year - 11 wins out of 25 tests - the Boks still didn't beat anyone of note, and Wales put out a near B team that was down to its fourth tighthead prop.

Coetzee kept his job last year because there was no viable alternative coach. But South Africa's new director of rugby and Coetzee's new boss, Rassie Erasmus, is tipped to take over two years out from the Rugby World Cup.

Coetzee, however, was in a defiant mood: "I am signed for 2019, that is what my contract says.

"You cannot expect to build Rome in one day. Last year was a fiasco, definitely, so we started from scratch this year. The players are much better conditioned, so there is already progress. The players are hurting at the moment because they feel they let themselves down, and you can only feel like that if you have a good team environment."

Wales, missing almost an entire first-choice side including eight British Lions, took a page out of the playbook Ireland used to beat the Boks 38-3 a month ago and used kicks to sow panic.

A crosskick by flyhalf Dan Biggar was caught on the run by right wing Hallam Amos. When he was finally caught, center Scott Williams was in support to score.

That try set up the second three minutes later. Biggar set up to kick and Springboks fullback Andries Coetzee moved to cover the touchline. Instead, Biggar chipped down the middle, South Africa failed to commit to the ball, and new center Hadleigh Parkes scooped it up and scored for 14-0 after eight minutes.

South Africa slowly grew into the match, and hooker Malcolm Marx carried four defenders to the line but there were too many bodies for a try to be given, so they took a Handre Pollard penalty.

Then they conceded another soft try. Coetzee was charged down by Biggar. Wales No. 8 Taulupe Faletau, who collected the ball and put Parkes in, was in front of Biggar at the time but nobody complained.

Parkes, playing on the day he became eligible for Wales on residency, became the first Wales player to score two tries on debut since George North in the same fixture in 2010. On that day, Wales lost after leading 20-9 with 34 minutes to go.

This time, Wales led 21-3 with 43 to go. And blew it again.

Just before halftime, Boks wing Dillyn Leyds counterattacked from his 22, Jesse Kriel extended it, and wing Warrick Gelant finished it off.

South Africa deserved to be 11 down at the break, but was back in the hunt without captain Eben Etzebeth, who walked off cradling his left arm.

After halftime, the Springboks confirmed the momentum change with tries to flyhalf Pollard and center Kriel. Pollard converted Kriel's from the sideline and South Arica led for the first time, 22-21 in the 65th.

Halfpenny's penalty in the 68th put Wales back ahead, then Coetzee made a tactical mistake: He replaced the on-fire Pollard with Elton Jantjies.

Jantjies, coming in cold, fumbled twice, the first time after 15 phases. It was the end of the Boks, and probably Coetzee.