LOS ANGELES — LeBron James will not play in the final two games of the Lakers season because of soreness in his left ankle, the team announced on Friday.

The Lakers, already eliminated from play-in tournament contention since Tuesday’s loss to the Phoenix Suns guaranteed the San Antonio Spurs would finish ahead of them for the No. 10 spot in the Western Conference, host the Oklahoma City Thunder on Friday and end the season on the road against the Denver Nuggets on Sunday.

James has already missed five of the Lakers’ last six games since spraining his left ankle against the New Orleans Pelicans on March 27.

James will finish the season averaging 30.3 points — second in the league behind Joel Embiid of the Philadelphia 76ers (30.4) — in 56 games. Should Embiid’s average dip below James’ as the Sixers finish out their season, James cannot claim the scoring title while inactive. A player must play at least 58 games to be eligible for the distinction.

Still, it was the most points James, 37, has averaged since his third season in the league when he scored 31.4 points per game for the Cleveland Cavaliers. The scoring average is also the most ever for a player in his 19th season.

L.A. went just 25-31 in the games James played, marking the first time since his rookie year with the Cavs where his team finished with a sub-.500 record in the games he played.

“He’s done everything in his power, and to his ability, beyond what can be reasonably asked of a team’s best player,” Lakers coach Frank Vogel told ESPN when asked about James’ season last month. “He’s done it on the court, he’s done it with his leadership and keeping everybody engaged in the fight.

“And I don’t think anybody can say anything other than he’s given everything that he can give to this year’s team.”

It is the second time in James’ four seasons with the Lakers where he finished the season out of the lineup with an injury while the team failed to make the playoffs.