ROME (AP) -- Way back in August when Liverpool was sweating its way through the playoffs just to qualify for the Champions League group phase, going all the way to the final wasn't even on the Reds radar.
Not after a season in which Liverpool didn't even play in Europe.
Not when no one could have imagined that Mohamed Salah would develop into a scorer to rival Lionel Messi. Or that Liverpool would score a Champions League-record 46 goals -- surpassing the mark set by Barcelona in 1999-2000.
Yet 10 months later, Liverpool is going to face two-time defending champion Real Madrid for the most coveted trophy in club football.
Liverpool advanced to its first Champions League final in more than a decade despite a 4-2 loss at Roma on Wednesday.
The Reds scored two early goals and that was all they needed to advance 7-6 on aggregate after a 5-2 win in the first leg of the semifinals.
"We came in as a qualifier and now we're in the final," Liverpool coach Juergen Klopp said. "Now we will go to Kiev, which sounds crazy but is the truth. We will go to Kiev."
The final is scheduled for May 26 in Ukraine.
Sadio Mane took advantage of a misplaced Roma pass to put Liverpool ahead nine minutes in and Georginio Wijnaldum restored the advantage with a header after Milner's own goal.
Edin Dzeko equalized for Roma early in the second half and Radja Nainggolan scored two late goals for the hosts as the Giallorossi narrowly missed out on another miracle after their stunning 3-0 second-leg victory over Barcelona in the quarterfinals.
"Tonight was all about getting the job done," said Liverpool midfielder James Milner, who scored an own goal.
Madrid beat Bayern Munich 4-3 on aggregate in the other semifinal.
"These fans deserve to be in the final, and they'll have a great time in Kiev regardless of the result," Liverpool defender Andy Robertson said. "We ended up losing tonight, but they threw everything at us."
Roma was left feeling aggrieved about two penalty decisions that weren't given.
"The VAR would have given us what was taken from us tonight," Roma coach Eusebio Di Francesco said. "That was ridiculous. ... But Liverpool certainly didn't steal anything from us. They played 45 extraordinary minutes (in the first leg) and we played two second halves that were just as extraordinary."
Liverpool last reached the final in 2007, when it lost to AC Milan, having won the last of its five titles over Milan two years earlier.
The 13 goals scored between the two legs was a record for a Champions League semifinal.
"When two squads play in an open manner like that, it's more like a boxing match," Di Francesco said. "There should be more matches like these."
Klopp was full of complements for Roma.
"What a performance, what a comeback. What a brave football game," the German manager said. "It was the first time we were not as good as we can be. So we needed luck."
There were concerns of fan violence surrounding the match after two men from Rome were arrested on suspicion of attempted murder following an assault outside the stadium before the first leg in Liverpool.
Supporters of both clubs met at Rome's City Hall earlier Wednesday to condemn violence and express solidarity with Sean Cox, the Liverpool supporter who was severely injured in the clashes last week.
Inside the stadium, fans of both sides lit flares in the stands before kickoff. It was so loud at one point that the Champions League anthem couldn't be heard.
With Liverpool advancing and Roma winning the match, both sets of fans applauded their clubs at the final whistle.
Afterward, Liverpool players posed near their fans behind a banner that read, "Sean Cox: You'll never walk alone."
Like the first leg, Liverpool was more impressive early on before Roma asserted itself late.
Roma's defense looked out of sorts when Nainggolan misplaced a pass early on and Roberto Firmino set up Mane for an unchallenged goal -- the first that Roma has conceded at home in this season's Champions League.
Roma equalized six minutes later when Dejan Lovren's attempt to clear an effort from Stephan El Shaarawy ricocheted off teammate James Milner's face back into his own goal.
Ten minutes later, Edin Dzeko's attempt to head away a Liverpool corner went backwards instead toward Wijnaldum, who nodded it in.
El Shaarawy hit the post with a shot from beyond the area before the break.
El Shaarawy, who put in a strong performance, also had a role in Roma's second goal. His curling effort was batted away by goalkeeper Loris Karius and Dzeko had enough time to control the rebound before shooting firmly into the far corner for his eighth goal in 12 matches in this season's competition.
Roma could have had a penalty shortly after the hour mark, but Liverpool got away with an evident handball by Trent Alexander-Arnold as he blocked a close-range effort from El Shaarawy.
Nainggolan then put his team ahead on the night with a long-range shot off the post in the 86th for his first goal in 24 Champions League appearances.
In added time, Nainggolan converted a penalty following a handball by Ragnar Klavan.
Salah, who scored the opening two goals of the first leg and who has 43 goals in 48 appearances in all competitions this season, was held scoreless against his former club.