Aberdeen made unconvincing progress in the Europa League after a 1-0 defeat by Fola Esch in Luxembourg.
Aberdeen were ultimately thankful for two injury-time goals at Pittodrie after Samir Hadji reduced their first qualifying-round aggregate lead to 3-2 when the hosts exposed a shaky Dons defence in the final minute of the first half.
The visitors survived a major scare when Fola hit the post and they edged through after a difficult finale with the injured Willo Flood struggling to make any contribution.
Aberdeen had an early warning at the Stade Josy Barthel when a ball over the top sent Hadji away, but Joe Lewis saved at his near post.
The Dons settled and Shay Logan and Kenny McLean both shot just wide from distance before the visitors got their first effort on target in the 20th minute. Peter Pawlett got round the outside of the Fola defence down the left and crossed low for Jayden Stockley, whose near-post effort was blocked by the goalkeeper.
Logan had a penalty appeal rejected before the hosts began to increase their attacking threat. They were off target from a Hadji header and Stefano Bensi volley but the Dons did not heed the warnings as a slackness crept into their defensive play.
And Fola threw the tie wide open when one simple pass cut the Dons open. Centre-back Andrew Considine pressed the ball as Bensi received an inside pass, but a first-time ball put his strike partner clear with Ash Taylor slow to respond.
The forward, whose father Mustapha helped Morocco knock Scotland out of the 1998 World Cup, raced into the box and fired high into the net.
Derek McInnes made two half-time changes with Mark Reynolds and Flood on for Anthony O'Connor and Pawlett, but his side were almost two down within five minutes when Taylor allowed Bensi to turn and sat off him 25 yards out. The striker curled the ball towards the top corner and Lewis pulled off an excellent diving stop.
The English goalkeeper saved from Tom Laterza following the resulting corner before the Dons appeared to take control of the game.
But the respite proved brief. Some sloppy possession play in the 75th minute saw Aberdeen stretched at the back and Emmanuel Francoise cracked a 22-yard drive against the inside of the post.
With Flood limping badly and the Dons having used three substitutes, Aberdeen were effectively a man down and Lewis saved from a curling effort from Gerson Rodrigues.
Aberdeen should have had a penalty with eight minutes left when substitute Adam Rooney was clearly tripped by Billy Bernard, but the Norwegian referee booked the incredulous Irishman for diving.
That set up a fraught finish but Lewis ultimately secured the Dons' progress when he scrambled to catch Hadji's hooked effort.
ends
Europa League News
Nicol: Emery sacking absolutely his fault
Steve Nicol says the apathy of players and fans are partly why Arsenal had no choice but to sack Unai Emery.
Sources: Unai Emery's position at Arsenal 'untenable'
Senior figures at Arsenal are reviewing the position of Unai Emery, and he could be sacked before Sunday's trip to Norwich, sources have told ESPN.
Chong's inexperience proved costly for Man United
Steve Nicol talks through Tahith Chong's epic miss for Man United vs. Astana in the Europa League.
Xhaka 5/10 as Arsenal lose again, pressure on Emery increases
Arsenal's winless run reached seven games, as Eintracht Frankfurt turned around a 1-0 deficit to win 2-1 and put Unai Emery's future in real doubt.
Arsenal woes continue with defeat to Frankfurt at half-empty Emirates
Arsenal endured more home misery as they suffered a 2-1 to Eintracht Frankfurt in the Europa League on Thursday.
Jesse Lingard 'led by example' as Man United captain
Ole Gunnar Solskjaer sees plenty of positives for Man United despite their defeat to Astana.