Liam Buckley's side produced one of the best ever performances from a League of Ireland side in Europe to gain a 1-1 draw in Poland last week and when the draw set up a mouthwatering clash with Celtic for the winner, fans were dreaming of a clash with the Hoops at the Aviva.
Those hopes were ruthlessly snuffed out by a Legia side who showed a cutting edge which was lacking last week.
The hosts began brightly and an early effort from Killian Brennan straight at Dusan Kuciak.
A sloppy clearance from Ger O'Brien was seized upon by Ondrej Duda in the 10th minute but his effort was too close to Brendan Clarke.
The visitors has the ball in the net soon afterwards but Michał Kucharczyk from the searching through ball.
Legia were enjoying more possession but the Saints had the next chance as Brennan wriggled free in midfield but his tame shot was straight at Kuciak.
The Polish champions were looking dangerous and took the lead on 26 minutes as first leg goalscorer Miroslav Radović found way too much space in the Pats area and he slotted the ball calmly past Clarke.
The response from the League of Ireland side was good and they were desperately unlucky not to equalise when Keith Fahey's deflected effort was kept out by the fingertips on Kuciak.
Liam Buckley needed to inspire a response from his side in the second half but it was Legia who started the second period brighter with Radovic continuing to cause problems.
Mark Quigley was introduced for Chris Forrester by Liam Buckley to add some spark.
Keith Fahey was looking the most likely to force an equaliser and he volleyed a shot just past Kuciak's post after a Saints' corner was cleared in his direction.
In the 60th minute, Michal Zyro beat the offside trap but his rasping volley was stopped at point-blank range by Clarke.
There was another close call for the Inchicore side six minutes later when Tomasz Brzyski's free kick flashed just wide of the post.
A goal was coming and it arrived in the 69th minute for Henning Berg's charges as Sean Hoare missed a tackle and Zyro poked the ball past Clarke.
Pats now needed three and could have pulled one back six minutes later when Killian Brennan's ball found Christy Fagan but Greg Bolger took it off his toe and blasted over.
The game was slipping away and the Poles could have had a third goal of the night as Brennan was caught in possession in midfield and and Duda galloped forward before laying off for Zyro who forced Clarke into a save.
The gulf in class between the teams was growing and the boisterous travelling fans had more to shout about in the 84th minute as Radovic scored his second of the night.
There was time for more and Legia had a fourth goal with three minutes of normal time remaining as substitute Marek Saganowski got his name on the scoresheet with a tap-in and Conan Byrne's own goal in injury time capped a night to forget for the Saints.
Legia will give Celtic plenty to think about next week while St Patrick's Athletic must concentrate on domestic affairs for the remainder of the season.