Maryland players, shown last week celebrating a goal against in their NCAA tournament win over West Virginia, had little to be overjoyed with on Sunday as the Terps lost their third-round game to Louisville, 4-2. (Matt McClain/FOR THE WASHINGTON POST)

From almost the start of the NCAA men’s soccer tournament match Sunday, Maryland found itself under extreme duress against Louisville. And even after the Terrapins came back twice to tie the third-round game, there was a profound sense that it wouldn’t end well for them.

Relying on a makeshift back line and an inexperienced goalkeeper, the fifth-seeded Terrapins never seemed comfortable on defense and succumbed to No. 12 Louisville’s polished counterattack, 4-2, before 2,660 at Ludwig Field.

Colin Rolfe had a goal and three assists, including the cross that led to freshman Daniel Keller’s go-ahead strike in the 79th minute, as the Cardinals (14-6-2) advanced to play UCLA in the quarterfinals.

“I feel terrible for our guys because they’ve played some great soccer this year, some of the best soccer in years here,” said Coach Sasho Cirovski, whose team enjoyed its best start since 1968 (11-0-1) but fizzled in the final month. “Unfortunately we just couldn’t put together a defensive performance worthy of advancing.”

The top-ranked team in the country for several weeks this season, Maryland (14-4-3) ended in a 1-3-2 rut. Sunday’s defeat marked the fourth time in six years that the Terrapins have been ousted from the tournament at home.

Senior center back Alex Lee, who has been bothered by a thigh ailment for weeks, didn’t play and right back Marquez Fernandez departed in the first half with an injury. Cirovski also selected freshman goalkeeper Keith Cardona to start over senior Will Swaim for the second consecutive match.

All of those factors led to a messy defensive performance. Cardona made two quality saves but should’ve prevented the first two goals. Maryland answered each time, on goals by Casey Townsend and Matt Oduaran, but late in the match, Keller’s deflected shot found the corner and Michael Roman sealed the outcome from distance in the 84th minute.

“I don’t second-guess myself,” Cirovski said, responding to a question about starting Cardona. “He made a couple of saves that really kept us in the game. Unfortunately, we just gave them too many opportunities. Keith wasn’t the reason we lost. When you give up four goals, it’s a lot of moving pieces throughout the field. As a unit, we were not the better defensive team.”

Louisville, the 2010 runner-up, went ahead in the 19th minute when Rolfe placed a through ball between two defenders to Nick DeLeon, who beat the late-arriving Cardona.

Despite the problems, Maryland pulled even in the 34th minute. Patrick Mullins served an end-line cross to the back post, where Townsend headed it in for his 17th goal of the season and 43rd of his career, earning him a share of third place on Maryland’s career list.

Cardona made an excellent reflex save two minutes after halftime, but in the 52nd, two critical errors led to Rolfe’s go-ahead goal. Cardona remained rooted to his line on Kenney Walker’s long ball, allowing Rolfe to latch onto it without a challenge.

On Rolfe’s shot from 18 yards, Cardona allowed the ball to carom off both hands and trickle into the net.

Maryland answered in the 68th when Oduaran turned in tight space at the edge of the six-yard box and scored his first goal of the season.

“I thought we were going to score again,” Townsend said. “We had them on their heels.”

But Maryland cracked again. Rolfe crossed from the end line to Keller for a 10-yarder that struck a defender and deflected out of Cardona’s reach.

“Anytime we had time and space to play, we looked to play in behind” Maryland’s back line, Cardinals Coach Ken Lolla said. “We had the guys who could get in behind and get on the end of things and create some problems for them.”

CONNECTICUT 3, JAMES MADISON 0: In Storrs, Conn., Carlos Alvarez and Tony Cascio had a goal and an assist apiece as the third-seeded Huskies (19-3-2) routed the No. 14 Dukes (13-5-2).