With deadly terror attacks in Europe showing little sign of waning, Germany's threat level remains high. German officials have revised and tightened the country's surveillance laws, while counter-terrorism measures continue to be expanded.
Germany's Federal Criminal Police Office (BKA) has primary jurisdiction for domestic security and combating terrorism, while intelligence work is divided between the Federal Office for the Protection of the Constitution (BfV) and the Federal Intelligence Service (BND).
All three agencies have seen their powers significantly expanded in recent months.
DW looks at what powers federal police and security forces have in preventing terror attacks.
Perhaps no aspect of Germany's security measures has come under greater scrutiny than its surveillance laws.
For historical reasons, the German government is obliged to protect and respect personal privacy, which is why the country has had some of the most restrictive surveillance laws in the world, with stronger measures often falling afoul of the German constitution.
However, the increased terror threat has seen the government tighten measures on the streets and online.
In June 2017, the German government added an unprecedented spate of new public surveillance laws to Germany's Criminal Code. This saw a major increase in the number security cameras installed across cities and sanctioned federal police to wear body cams while on patrol.
Meanwhile, the BfV is responsible for monitoring "anti-constitutional" and extremist activity by intercepting data sent through telecommunications networks, such as emails, telephones and text messages. It does this either by requesting the data from the telecom providers, or through what is known as the "Trojan Law," which allows malware to be installed on computers and smartphones. Intercepted data is allowed to be stored for up to six months.
The BND, by contrast, is responsible for collecting intelligence outside Germany. Because some of the world's largest internet access points are located in Germany, the BND's capacity to tap into these exchanges gives it particularly strong access to international intelligence. The BND is also allowed to share intelligence with foreign agencies, and information sharing with EU partners and the US' National Security Agency is commonplace.
Stop and search
During any stop and search, German police are by law required to give a reason as to why an individual has been picked out.
However, in many circumstances, police are allowed to frisk individuals as a preventative measure. If there is reason to believe that there could be a risk to public safety at a certain location, this overrides an individual's rights, and police are allowed to stop and search anyone within the vicinity.
Federal states are able to further tighten their own police stop and search powers. In one extreme example, the city state of Hamburg declared entire districts as "danger zones" following riots by left-wing protestors. As a result, anyone walking through those zones could be stopped and searched on site for no specific reason.
Detention without charge
Each state in Germany, with the exception of Bavaria, is allowed to detain suspects without charge for a maximum of 14 days.
However, in 2017 the southern state of Bavaria caused a huge legal stir when its regional government sought to keep suspected assailants indefinitely detained without charge. The state's ruling party, the Christian Social Union, was accused by a number of opposition lawmakers and the press of seeking to undermine the rule of law.
The Bavarian regional government ultimately introduced laws allowing suspects to be held without charge for up to three months at a time. However, every three months, a judge must decide whether the suspect can be released or not. In theory, a suspect could remain imprisoned for years.
The German government's list of banned organizations is mostly made up of neo-Nazi and Islamist groups. Anyone found to have an association to such groups, whether it be through disseminating propaganda material or sporting their symbols, can be prosecuted.
The law concerning the symbols of unconstitutional groups was implemented to deal with Nazi insignia. But in 2014 the flag used by the so-called "Islamic State" was added to the list.
Checks at the border
While Germany is a member of the Schengen area, which allows for the free movement of goods and people across EU borders, in 2015 the federal government introduced controls at its borders as a response to the wave of migrants and refugees entering Europe.
While German officials are allowed to ask for identification documents, in June 2017 the European Court of Justice (ECJ) ruled that border checks could not be used to circumvent Schengen regulation on free travel.
According to the ECJ, authorities may demand identification within 30 kilometers of an international border if the check is deemed "proportional" and done to prevent illegal entry into the country.
Refugees due for deportation can also be detained for up 10 days, while those deemed potentially dangerous can be made to wear ankle tags and have their movements restricted.
No German military on the streets
Unlike in many other countries, Germany's constitutional law prohibits the military from being deployed on the streets. For historical reasons, only the police are responsible for internal security, although in extreme circumstances the military can be called upon within "narrowly defined limits."
However, in light of heightened terrorist threats across Europe, there are concerns the German government may amend this law. Several German states have already allowed police and military forces to conduct joint-training exercises. German Interior Minister Thomas Maiziere said the drills were a merely a "precaution for an unlikely but conceivable situation."
Still, despite suffering a string of terror attacks in 2016, Germany has not deployed the military on its own soil since the Second World War for anything other than natural disaster relief.