Public service time! In the USA, there is a cottage industry of people spreading the word about what rights citizens have during encounters with police. One of the best videos is from 'Flex Your Rights'. It's just below. The video addresses automobile stops and house searches, but I decided to concentrate on this post on police stopping and questioning people on foot. The video starts just as a a police car pulls up to question a young black male. The cops are investigating illegal graffiti in the area. The lawyer comments on each step of the transaction:
So what's the situation in Germany? A popular German legal website has a short but informative article here (g). The basic ground rules:
Police must always give you a reason for stopping and questioning you. However, this reason does not alway have to be a concrete suspicion. In certain circumstances police are permitted to stop people as a preventive measure to avoid dangers to public safety (Gefahrenabwehr). These are not intended to assist in investigating a crime, but rather preventing one.
For this justification to apply, it needs to be shown that a danger to public safety exists at a particular location — for instance, a demonstration in which disturbances are likely to take place, or a well-known drug market where crimes are routine.
Such places are often named specifically in your local state's local-policing law — for instance Bavaria allows suspicionless public-safety searches where large numbers of prostitutes gather. Also, in special circumstances police can declare entire regions of a city 'danger zones', as Hamburg did in 2014 during left-wing demonstrations.
And what if the police do stop you based on general location? You are required to answer basic questions: your name, your address, your nationality, date and place of birth. The police can ask you to present an identification card (either the German national identity card or a passport), but you are not required to carry this identification around with you everywhere, so if you don't have it with you, that is not against the law.
The police may ask you further questions, such as where you are coming from and where you are going, but you are not required to answer them. A lawyer quoted in the article recommends that you do answer them in a polite but very curt manner, since this is likely to de-escalate the situation.
Note that this applies only when the police stop you without any concrete suspicion you have committed a crime. If they do have such a suspicion, they may be entitled to ask more questions.
The police are also permitted to engage in questioning of random people without individualized suspicion of crime at airports and train stations and trains. The purpose of these stops is usually to try to find illegal immigrants. A German court has found that stopping someone based solely on their appearance or skin color is unconstitutional according to the German Basic Law. (The lawyer in me says they will almost certainly find other ways to justify the search, though.)