The 27-year-old, signed from Le Havre for £400,000, leaves the Foxes having made 180 appearances, scoring 48 times.
His arrival at the Etihad ensures the end of a lengthy pursuit by Guardiola, the City manager, who was left frustrated by Leicester's hardline stance in the January transfer window.
Mahrez struggled to replicate his form the following year with the Foxes falling short as a team in the Premier League, though like his team-mates, he improved after the departure of Ranieri and ultimately accrued 10 goals and seven assists in all competitions.
Manchester City director of football Txiki Begiristain has described new signing Riyad Mahrez as "one of the Premier League's most exciting players".
BMC beats Sky to win Tour de France team time trial Froome was left 55 seconds behind in the overall standings with another week of nervy rolling stages before hitting the Alps. BMC's Richie Porte is level with Froome with their respective teams looking to do well on the team time trial.
With Mahrez looking likely to leave the King Power Stadium this summer, Leicester are looking to bring in reinforcements as City winger Patrick Roberts could be heading the other way in a deal which is said to be worth £10m. When combined with his creativity and eye for goal, Mahrez is one of the most potent attacking players in the Premier League at his best.
"I am very happy to have signed for City, a team that plays great football under Guardiola", said Mahrez, a Premier League victor with Leicester.
'I think we can be successful over the coming years and I believe my own game can develop under Pep's management'.
Mahrez - who made 179 appearances for Leicester, scoring 48 times -went on global duty for his country in June and the writing was on the wall when Leicester allowed him extra time off.