An act of terrorism by definition is politically motivated. In terms of Muslim terrorists(IS, Al-Qaida, Taliban, Boko Haram etc) it's a blurry line as they act under the pretense that their one true religious interpretation means they deserve to be in charge politically.
The guy in Munich was not doing it in the name of any political organisation as far as the Police investigation concluded. The dude in Würzburg was a terrorist as his axe rampage in the local train was supported/instructed by IS.
Weird definition. Terrorism is an act of violence intended to induce fear in a population to pressure them to move in a certain direction. It, obviously, doesn't have to be in the name of a terrorist organization.
Edit: So it has to be ideologically motivated, but it doesn't have to be in the name of an actual organization.