MANCHESTER, England — Leicester had a late penalty ruled out in bizarre circumstances as Manchester City held on for a 2-1 win on Saturday to move into third place in the English Premier League and close in on Champions League qualification.

Riyad Mahrez was adjudged to have kicked the ball against his standing foot as he slipped while taking the 77th-minute penalty, which span high into the top corner. The referee disallowed the goal and awarded City a free kick, holding up two fingers to show that Mahrez had taken two consecutive touches.

“The referee was so brave in making the decision,” City manager Pep Guardiola said. “I’ve seen that happen before (but) a long time ago.”

Leicester goalkeeper Kasper Schmeichel described it as a “freak incident,” and pointed out that Atletico Madrid forward Antoine Griezmann did the same from the penalty spot in the Champions League semifinals in midweek and the goal was allowed to stand.

Goals by David Silva in the 29th minute and Gabriel Jesus, from the penalty spot, in the 36th gave City a 2-0 lead at Etihad Stadium.

Leicester had been outplayed up to that point, but replied through Japan striker Shinji Okazaki’s acrobatic volley in the 42nd and caused City problems in the closing stages.

City climbed two points above Liverpool, which dropped to fourth place ahead of its match away to West Ham on Sunday, in the race for a top-four finish and qualification for next season’s Champions League.

One win from its last two matches, at home to West Bromwich Albion and away to Watford, should be enough for City to finish at least in fourth place.

City has had problems dealing with Leicester’s counter-attacking style and pace on the break, losing 3-1 at home last season and then 4-2 in December. But the two early goals settled City here while the defense coped better with the dangerous Jamie Vardy up front.

Leicester’s players will count themselves unfortunate, however — and not only because of the unusual way Mahrez’s penalty was chalked off.

The visitors also challenged the referee’s decision to award City’s opening goal, and they might have had a point.

Raheem Sterling was in an offside position and appeared to be directly in Schmeichel’s line of vision when Silva took a first-time shot from Sane’s cross.

The ball bobbled into the corner from 15 meters out, after Sterling swung a foot at it and missed, with the unsighted Schmeichel not even attempting a save.

“First goal is offside, anyone who has played football knows it,” Schmeichel said. “He is blocking my view, he goes for the ball.”

Sane was involved in the second goal, too, the left winger getting crudely taken down by center back Yohan Benalouane in the area. Gabriel Jesus, taking over penalty duties from Yaya Toure, converted by sending Schmeichel the wrong way.

Okazaki scored the goal of the game — his first in December stretching over 23 matches — when he met Marc Albrighton’s cross with a flying volley that flew high into the net.

Knowing the significance of a victory, City’s players appeared nervous in the second half and Leicester had a great chance to leave with a point when Mahrez was tripped by Gael Clichy just inside the area following a twisting run.

Mahrez couldn’t capitalize and with some desperate late defending, City clung on.

“There’ve been times throughout the season when I felt we deserved more but didn’t get any luck,” Sterling said. “Today, we got the luck.”