David Lough and Jimmy Paredes helped catapult the Orioles to a needed win on a difficult night in Baltimore.

In what proved to be one of the strangest nights in Camden Yards' 23-year history — a dramatic ballgame inside the stadium and a tumultuous environment outside of it — the Orioles ultimately broke their five-game losing streak by beating the Boston Red Sox, 5-4, on a walk-off homer by David Lough in the bottom of the 10th inning.

Lough never had hit a game-ending home run, and his first one came before an audience that literally had been captive for the previous inning.

Moments after the Red Sox made a stunning comeback to tie the game at 3 in the top of the ninth, stadium public-address announcer Ryan Wagner, on behalf of the mayor's office and the city police department, issued a sobering declaration to what remained of the announced 36,757. Because of unrest caused by the ongoing protests downtown over Freddie Gray's death, the fans at Camden Yards were in a lockdown, told they were prohibited from leaving the ballpark until further notice.

An inning later, after Adam Jones tripled to start the bottom of the 10th with the Orioles trailing by one, the advisory was modified. Fans were permitted to leave but warned to avoid Harborplace and areas west and north in the city. The ballpark's south and west gates were opened.

But the fans stayed, with too much baseball drama unfolding on the most surreal of evenings to leave.

“It's good to see people not leave in those types of situations, because the fan base is huge when it comes to that,” Lough said. “Adam Jones hits that one in the gap, and you get that ball rolling and you can ride off that and each other. And to watch the fans cheer and be loud like they do, it was awesome.”

Orioles bench coach John Russell managed the team Saturday night against the Boston Red Sox — for a few innings, anyway.

Manager Buck Showalter’s father-in-law, Phil McMahan, died of cancer April 9. The manager and his wife, Angela, were expected to fly back from a memorial service in Nashville,...

The Orioles (8-10) will go for the series win Sunday afternoon against the Red Sox (10-8), in what officials and players hope is a less tense environment downtown.

“I understand they are fighting for a good cause,” Jones said of the demonstrations in the wake of the death of Gray, who died after suffering spinal cord injuries while in police custody following his arrest April 12 in West Baltimore. “I just want people to be safe. I don't want people to be hurt. I understand, fight for your rights. It's what you should do. But try to be safe and be smart about it.”

As the tumult continued outside, the focus inside Camden Yards was distinctively baseball, with a few subtle reminders that things weren't quite status quo.

During the singing of the national anthem, performed sweetly by the Matsunaga Elementary School Safety Patrol Choir, a police helicopter circled above while sirens could be heard in the distance.

At the 7:05 p.m. first pitch, the stadium was at about 40 percent capacity, sparse for an Orioles-Red Sox game on a Saturday night. By mid-game, the ballpark appeared more than half-filled, but never came close to reaching the announced number of tickets sold.

The closing of Gate H, near Babe Ruth Plaza, for at least a half-hour contributed to the below-average turnout, as did the snarled thoroughfares leading to the city.

Somehow, Orioles manager Buck Showalter made it to the Camden Yards dugout by the top of the third inning. He had been in Nashville, Tenn., earlier in the day to attend the memorial service for his father-in-law.

“It was hard,” Showalter said of his travel. “A lot harder on some other people today, so it's a small inconvenience, comparatively speaking … It's a game of baseball, and those are life issues. So this kind of pales in comparison to what's going on in my life off the field and what's going on in our city.”

The Orioles appeared to be on their way to victory in the ninth, but closer Zach Britton blew his first save of the season by giving up a walk and two infield hits before third baseman Manny Machado made his second late-inning error in his last two games. With the bases loaded and one out, Pablo Sandoval hit a grounder to Machado, who stepped on third for the second out. But his wild throw skipped past Chris Davis at first and allowed the tying run to score.

Boston's Xander Bogaerts led off the 10th with a solo homer against Brad Brach to break the tie, but the Orioles made it 4-4 in the bottom of the inning when Davis hit a sacrifice fly to score Jones and set the stage for Lough's full-count homer to the right-field flag court against Koji Uehara (1-1).

There were other heroes for the Orioles. Designated hitter Jimmy Paredes had four hits, including a RBI double in the first and a solo homer in the fifth. The 26-year-old is now batting .414 with three homers in seven games since coming off the disabled list. Left-hander Wei-Yin Chen tied a career high with eight innings pitched, allowing just two runs and retiring his last 12 batters.

But the night will be remembered for Lough's homer — and for what happened around the ballpark.

“It's unfortunate the way things have unfolded the way they have, but we all also understand that maybe we can give this city a little shot in the arm and pick them up,” Davis said. “I think that was big tonight. I don't think it was any coincidence that we were able to come back and win. It was huge for us and hopefully huge for the city.”