Three-time European champion Manchester United was eliminated from the Champions League when it lost 2-1 at FC Basel, with Manchester City joining its local rival on the sidelines despite beating Bayern Munich.
United needed only to avoid defeat in Switzerland on Wednesday to secure a 15th knockout round appearance in 16 Champions League seasons but drops into the Europa League while Basel advances.
City, the Premier League leader, also heads into the second-tier tournament despite a 2-0 win over already qualified Bayern.
Napoli's 2-0 win at Villarreal took the Italian side through instead. Lyon won 7-1 at Dinamo Zagreb to complete a remarkable turnaround and qualify ahead of Ajax, which lost 3-0 to Real Madrid.
CSKA Moscow won 2-1 at Inter Milan to take the final spot and complete the 16-team lineup for the next round.
'A Swiss team ... it's crazy'
After losing three of the last four finals, United was expected to join Chelsea and Arsenal in the next round after the London clubs progressed on Tuesday.
But, with United defender Chris Smalling lying dazed from a collision with teammate Nemanja Vidic, Basel captain Marco Streller put his team ahead with a ninth-minute shot past goalkeeper David de Gea.
Things got worse for United in the 43rd when captain Vidic was carried off on a stretcher after twisting his right knee while making a challenge.
And despite almost constant pressure from United, Basel doubled its lead through Alex Frei in the 84th. United's Phil Jones got a late goal and his team twice hit the bar but to no avail.
Benfica topped Group C with 12 points after a 1-0 win over Otelul Galati. Basel finished with 11 and United was two points further back.
"It's incredible," Basel goalkeeper Yann Sommer said. "A Swiss team, a little country, against Manchester United, one of the biggest teams in the world - it's crazy.
"Manchester are a good team, they had a lot of pressure and sometimes we were a bit lucky not to concede, and this is a crazy night. We are through and Manchester are out - it's super."
City needed to beat Bayern to have any chance of prolonging its first season in the Champions League and did so with ease, scoring a goal in each half through David Silva and Yaya Toure.
But Gokhan Inler and Marek Hamsik scored second-half goals to secure Napoli's place as the Group A runner-up to four-time European champion Bayern.
Napoli labored to find a way through the Villarreal defense and the home side had a first-half goal ruled out for offside before Inter launched a 25-meter drive that left goalkeeper Diego Lopez motionless in the 65th. Hamsik added a second goal 11 minutes later with a close-range finish.
Napoli finished with 11 points to Bayern's 13. City had 10, while Villarreal became the first Spanish club to suffer six straight group stage defeats.
"We're very sorry for our supporters and I'm sorry for our players," City manager Roberto Mancini said. "I think we need to improve as a team because we got a tough group this year."
Lyon started its match at Dinamo Zagreb three points behind Ajax and needing a seven-goal swing to overturn the Dutch club's advantage on goal difference.
Real Madrid, which was already assured of top spot in Group D, helped out by completing this season's only perfect first-round record but Lyon did much of the hard work itself with a 7-1 rout of 10-man Dinamo.
Things looked bad for Lyon when Dinamo Zagreb overcame the 28th-minute sending off of Jerko Leko for a second yellow card, Mateo Kovacic putting the home side ahead five minutes before halftime.
But Bafetimbi Gomis equalised just before halftime and scored another three goals after the break, with Maxime Gonalons, Lisandro and Jimmy Briand adding the others as the home side fell apart.
Jose Callejon scored twice and Gonzalo Higuain once to give Madrid a 3-0 win at Ajax, which had two goals isallowed, leaving Lyon tied on points with the Dutch side but ahead on goal difference.
More details on this link: Manchester United out of Champions League - Football - Al Jazeera English