Rangers crashed out of the Europa League after an error by goalkeeper Allan McGregor helped Rapid Vienna score a late winner courtesy of Dejan Ljubicic on a night when victory for Steven Gerrard's men would have seen them through to the knockout stages.

Connor Goldson headed against the crossbar in the first half as Gerrard's side took control at Allianz Stadion, but the hosts kept a clean sheet despite being second best for much of the game.

Alfredo Morelos and Ryan Jack provided plenty of attacking endeavour for Rangers in the second half, but, the closer Rapid got to clinching the point that would see them progress from Group G, the more they slowed the pace of the game and frustrated their visitors.

McGregor sent a clearance to the feet of Veton Berisha in the 84th minute before Rapid swept forward and Ljubicic scored the goal that put his side into the last 32 at Rangers' expense.

Rangers were pinned back for much of the opening 10 minutes before Borna Barisic had a free-kick well saved by Richard Strebinger and the chance seemed to buoy Gerrard's men.

The visitors grew in confidence and hit the crossbar when James Tavernier's free-kick was met by the head of Goldson, who was agonisingly close to giving his side the lead from six yards out.

Morelos and Jack huffed and puffed after the break, the Colombian forward having a claim for a penalty ignored by the referee, but Rapid sensed they were still in with a chance of victory and maintained their physical approach at the back.

Gerrard sent on Eros Grezda and Kyle Lafferty to try and force a winner, but his attempts to turn the game were marred by McGregor's sloppy clearance that led to substitute Ljubicic's cool finish, low to the goalkeeper's right, which sent the Allianz Stadion crowd wild.