Stabshauptmann

Stabshauptmann (short: StHptm) meaning "Staff Captain", is a German Senior Captain rank and the highest military rank in the Bundeswehr for specialist officers ().
Bundeswehr.
Instead of being promoted to the rank of major, specialist officers that were holding the rank of Hauptmann (Captain) for a specific time are promoted to the rank of Stabshauptmann and given the salary of a Major. Sometimes regular officers are promoted to a post that is intended for a Stabshauptmann if there is no free post for a Major. 
The badge of rank is four silver stars. It is one of the rarest ranks in the German military. The rank has no history outside the Bundeswehr and has been created especially for the MilFD officers. Those are former NCOs who have accomplished a special training programme through which they are given the opportunity to become officers. Their duties are, however, specific, similar to that of a Warrant officer in the English-speaking armies.
⇒ Artikle: Ranks of the German Bundeswehr
⇒ Artikle: Rank insignia of the German Bundeswehr
Rank insignia.
On the shoulder straps (Heer, Luftwaffe) there are four silver pips (stars).
There is no corresponding rank for officers in Bundeswehr Joint Medical Service.
Historical background outside of Bundeswehr.
Historically, a rank named "Stabshauptmann" (also: "Stabskapitän") existed in several German armies in the 18th century. However, while the modern Stabshauptman is a Senior Captain senior to a regular Hauptmann, the historical Stabshauptmann was a Junior captain, ranking below Hauptmann rank. In 18th century armies companies often were "owned" by a noble man, who formally was the company's captain, but did not actually command the unit. Instead, the owner of the company appointed an officer from the company his "Stabshauptmann", who technically served as the Hauptmann's mere staff assistant, but actually led the unit in his place.
The reversing in ranking of "Hauptmann" and "Stabshauptmann" in modern times is consequence of the practice in modern German military organisations (Reichswehr, Wehrmacht) to name the highest rank of a rank group beginning with the prefix "Stabs-", indicating that the holder serves in staff position to officers of the next higher rank group, e.g. during World War II, the highest NCO rank in the German army was Stabsfeldwebel, who served as direct assistant to company-grade officers or in staff function. However, this is no longer represented in the Bundeswehr's post-World War II rank structure since the creation of rank levels senior to the "Stabs-" level of ranks, denoted by the prefix "Oberstabs-" ("Senior Staff-", e.g. Oberstabsfeldwebel). There are no plans to create the rank of "Oberstabshauptmann".
International comparison.
German pay grade of Stabshauptmann is A13, same as of Major (Hauptmann: A12). According to NATO's STANAG 2116, the NATO rank code of Stabshauptmann is OF-2, same as for regular Hauptmann and therefore equal to Captain rank in other NATO armies. To express the seniority of Stabshauptmann, "OF-2a" or other modifications of the official NATO rank code are in use unofficially.
A similar rank outside the German Bundeswehr is the "primo capitano" (First Captain) in the Italian military.