Maryland men’s soccer midfielder Amar Sejdic wanted to keep dancing. The junior had spent the last few minutes of halftime vibing to the various songs playing over the PA system at Ludwig Field.

He’d danced with goalkeeper Dayne St. Clair as they first walked onto the field and even got to hear a few extra measures of Cardi B’s “Bodak Yellow” as the team searched for a ball to begin the second half with.

When the music stopped, Sejdic’s shoulders sank and he prepared for the restart.

Sejdic and his teammates were loose at the intermission because they owned a halftime lead for the first time in nearly four weeks. Maryland’s offense broke out of its slump with a 3-0 win over Northwestern, and Sejdic picked up his first assist and goal of the season.

“We came out, we had a smile on our face and everything was just kind of fun,” Sejdic said. “When we do have a smile on our face and we have a positive approach to a game, then that’s what you see on the field.”

At the team meeting after Maryland’s 1-1 draw at UMBC on Tuesday, there weren’t many smiling faces to be found. Coach Sasho Cirovski laid into the team for more than 10 minutes, having grown frustrated with its performances over the previous two games, in which Maryland took 44 shots but scored just once.

“That one really felt like a loss,” midfielder Andrew Samuels said of the UMBC tie. “That game really motivated us to make sure we got our performances done and finish our chances.”

Cirovski did offer a caveat for his highly touted attack’s struggles: the Terps were on the road playing against strong defenses.

Maryland took advantage of Northwestern and its 177th-ranked defense in Friday’s home tilt.

“We’re a proud program. The players knew it was not their best effort on Tuesday,” Cirovski said. “We always bounce back.”

Northwestern goalkeeper Robbie White made five saves in the first 20 minutes, including one on a strong effort from Sejdic, who said he decided to shoot from longer distances Friday to give himself more chances at his first goal of the year.

White stopped another long shot form Sejdic in the 20th minute, but the rebound bounced to forward Sebastian Elney, who finished past White as the goalie tried to get up.

Midfielder Jake Rozhansky doubled Maryland’s lead in the 39th minute, receiving a cross from forward DJ Reeves right in front of goal and opening his right foot for an easy finish.

“I don’t think we had many goals this year where we really made a statement on how we wanted to play the game,” Sejdic said. “Getting two first-half goals, it was … a statement, like, ‘We weren’t here to mess around,’ and we want to let them know that it’s going to be like that throughout the rest of the game.”

The scores were Maryland’s first first-half goals since Sept. 4. The Terps entered halftime tied 0-0 in each of their previous five contests.

The Terps faced some tough teams in that span, including Indiana, Michigan State and UMBC, but they also failed to capitalize on first-half chances against Penn State and Rutgers.

At halftime, Cirovski challenged the team to score a third goal, having done so just twice in its first nine games. Sejdic, who said he felt his shots had been blocked “all season long,” answered the call.

Five minutes after his dancing was interrupted by the start of the second half, Sejdic stepped up to take a 50th-minute penalty kick. He finished cleanly to White’s left.

Instead of needing late goals to put away another otherwise-dominant performance, Maryland had its 3-0 lead and cruised to its first win in three games.

“We were not only creating chances but this game we were actually putting them away,” Samuels said. “We dominated the game.”