When World War II started in September 1939, the German Kriegsmarine was not prepared to challenge the allied naval forces.
Unlike the other arms of the German military, the naval construction plan (Z-Plan) had only started a few months before. Therefore the number and strength of available ships was not adequate for the needs of a major war.
In the years before the war, the Kriegsmarine believed that any military confrontation in the near future would not be against Great Britain again, Poland and France were seen as possible enemies and the naval construction was directed to with this possible enemies in mind. A possible confrontation with one of the major sea powers was not believed before the mid or late 1940, at a time where the Z-Plan should have been completed. As it got obvious that tensions with Great Britain started to rise in 1938, the fear of a military confrontation with Great Britain caused the increased speed of the introduction of the naval construction program. But even at this time, the Kriegsmarine still believed that a war with England was several years away.
In the early years, the Kriegsmarine achieved some remarkable results, like the invasion of Norway and the destruction of several major British ships, but this lucky time ended with the sinking of the battleship Bismarck
in May 1941. From this time, the major surface units were not used in such an offensive way as before, now the small number of operational ships made every loss more important.
The German U-boats could continue their successful operations until May 1943 - the technological advance of the allied forces made U-boat operations almost impossible then.
At the end of the war, only two of the major Kriegsmarine ships were still operational, all other were sunk, either during their operations or destroyed during the last months and weeks of the war in their bases.