It should be noted that after nearly three decades post Cold War, the larger German coast guard boats are again sporting a main gun (i.e. 57 mm Bofors). The older boats used to have equipment such as 76 mm Oto Melaras but those were dismounted and mothballed in the 1990s because the threat of armed confrontations in German coastal waters was gone and pirates had probably last been seen in the early 19th century. Nowadays though, the possibility of forward deployments in pirate-infested waters or for general peacekeeping business leaves you with the need of something heavier than, say, an MG3 mounted on the guard rail. Not to mention the theoretical threat of suicide speedboats in native German waters.
On a side-note, a Bofors gun would have come in handy a few years ago, when a Chinese freighter started burning sludge oil while still sailing through the city port of Hamburg. Restaurant customers dining outside near the river Elbe were not happy with loads of black soot flakes falling into their soup and air pollution monitoring sensors probably went to "infinite". However, the ship's captain just ignored all radio calls to stop or switch to Diesel fuel and steamed away into the North Sea.