Lahm won 113 caps and represented his country at three World Cups.
He said: "For me it is the right moment. I am leaving the national team in total harmony. During the last season I gradually reached the decision that the World Cup in Brazil would be my last tournament. I totally enjoyed my time with the national team.”
Lahm was one of Germany's stand-out performers at Brazil 2014, starting the tournament in midfield before reverting to right-back. He was one of 10 nominees for the Golden Ball award presented to the tournament's best player, but lost out to Lionel Messi.
Philipp Lahm leads German celebrations in Berlin (Reuters)
The Bayern Munich star led celebrations in Berlin on Tuesday, where the team paraded the World Cup trophy in front of 400,000 fans.
Vice-captain Bastian Schweinsteiger is the most obvious candidate to take over the armband from his Bayern clubmate.
However Schweinsteiger, who also has over 100 caps, turns 30 in a fortnight and may also decide the time is right to hand over to the next generation of German stars.
Germany are already the bookmakers' favourites to win the 2018 World Cup in Russia when stars such as Mario Goetze (now 22), Andre Schuerrle (23), Toni Kroos (24), Thomas Mueller (24) and goalkeeper Manuel Neuer (28) will have reached their peak.
THE GERMAN VIEW - Michael Wollny, Eurosport Germany
"This news is very surprising. Everybody expected him to target Euro 2016 at least. He’s 30 years old, the 'best age' for a footballer. We’re talking about one of (if not the) best full-back in the world. It’s virtually impossible to replace him equivalently. One could expect Schweinsteiger as a logical successor as captain. If not Schweini, Neuer might be a candidate as well as Khedira or Hummels."
POSSIBLE GERMANY STARTING XI AT 2018 WORLD CUP
Philipp Lahm player profile
- Sports & Recreation
- Bastian Schweinsteiger
- 2018 World Cup