Stabskapitän (staff captain) is a historic military rank, used in the Prussian and Russian armies. It ranked between the Premierleutnant (later called Oberleutnant) and Hauptmann/Rittmeister in the Prussian army, and between lieutenant and captain in the Russian army. Its holder represented the actual captain and company commander in his absence, frequently and often for long periods, should his (usually noble) Hauptmann show no interest in leading the company, though the Hauptmann would retain his rank, status and uniform.
In the army of Frederick the Great, a regiment's regimentschef, oberst, staff officers, company commanders and those of nearby rank received a far higher rank than the staff captains who actually led the company. From this difference later developed the salary difference between a first class "Hauptleute first class" and "Hauptleute second class".
A similar rank, yliluutnantti, is in use in Finnish military ranks.