Joel Embiid scored and rebounded. He blocked shots and even threw the most important pass of the game.

The only thing he didn't do is lose his cool after his hard foul triggered a scuffle.

After having to sit out the last game, there was no way Embiid was going to risk an ejection and miss his chance to help the Philadelphia 76ers seize control of the series.

Brooklyn Nets guard Caris LeVert (22) dunks past Philadelphia 76ers center Joel Embiid (21) during the first half of Game 4 of a first-round NBA basketball playoff series, Saturday, April 20, 2019, in New York. (AP Photo/Mary Altaffer)

Embiid had 31 points and 16 rebounds, and passed to Mike Scott for the go-ahead 3-pointer with 18 seconds left as the 76ers beat the Brooklyn Nets 112-108 on Saturday to take a 3-1 series lead.

Embiid also had a flagrant foul that led to a scuffle and two ejections during an eventful return to the lineup after missing Game 3 with a sore left knee.

"I know these guys are going to go at me because they want me to retaliate, so I've got to be mature when I'm on the court and just stay cool and not react," Embiid said.

"Today I could have reacted but I felt like my team needed me more than they needed Jared Dudley, so I've just got to stay cool and mature and do my job."

Tobias Harris had 24 points, eight rebounds and six assists for the 76ers. They can advance to the Eastern Conference semifinals for the second straight season with a victory at home Tuesday night.

They got a big boost from the return of Embiid, who scored eight straight points in the fourth quarter after the Nets led by seven. He helped the 76ers overcome the loss of Jimmy Butler, who was ejected in the third quarter after Embiid's hard foul on Jarrett Allen.

CELTICS BEAT PACERS 104-96 TO TAKE 3-0 SERIES LEAD

Even that ended up working out for the 76ers. Scott took what probably would have been Butler's position on the floor in the final seconds and turned Embiid's seventh assist into the go-ahead basket.

Embiid also had six blocked shots.

"Just look at the magnitude of what the numbers say, the influence that the numbers say that he must have had on the game," Sixers coach Brett Brown said. "To have 31 points, 16 rebounds, seven assists, six blocked shots and you win, well it's hard to sort of say it any better than that. He was dominant."

Caris LeVert scored 25 points after being inserted into the Nets' starting lineup. D'Angelo Russell and Allen each added 21.

Philadelphia 76ers center Joel Embiid (21) goes to the basket against Brooklyn Nets guard D'Angelo Russell (1)and forward Jared Dudley during the first half of Game 4 of a first-round NBA basketball playoff series, Saturday, April 20, 2019, in New York. (AP Photo/Mary Altaffer)

Dudley also was inserted into the starting lineup for the Nets and had been agitating the 76ers with his defense and his talking, but was gone midway through the third quarter as one of the central figures in the scuffle that spilled into the stands.

Embiid swung his arm forcefully while fouling Allen, and Dudley quickly moved in and bumped Embiid. Butler then ran in and pushed Dudley to start the shoving. Dudley, Simmons and referee Ed Malloy all got knocked into the seats, and after a lengthy video review, Butler and Dudley were given technical fouls and ejected, and Embiid's foul was ruled a flagrant 1.

Dudley said he was trying to send a message. The Nets have been upset over an elbow Embiid hit Allen with in Game 2 that they felt should have been an ejection, and were further angered after when Embiid laughed as he apologized in his press conference.

CLICK HERE TO GET THE FOX NEWS APP

"When you have a guy giving flagrant fouls, I mean Joel Embiid is second in the league in flagrant fouls," Dudley said. "So for that elbow he had before just to have a flagrant 1, no fine, no nothing, laughing in the media, if you think that a team that I play on is going to have (to accept) that, that's another thing coming, especially on this young team."

Embiid would later make the biggest mark with his offense. The 76ers were trying to get the ball to him trailing by one after Joe Harris' layup, but Embiid couldn't control the pass under the rim. But he regained the ball and found Scott in the corner for a 3 and a 110-108 lead.

Allen then turned the ball over after three Sixers surrounded him and Harris closed out the scoring with two free throws. Nets coach Kenny Atkinson was angry afterward, feeling Allen was wrapped up by Harris as he tried to roll to the basket.

Dudley and Simmons jawed at each other after Dudley gave him a long stare with his arms up after hitting a 3-pointer during a 9-0 run that gave Brooklyn a 63-53 lead shortly before halftime. The Nets led 63-57 at the break.