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.