During the war of the First Coalition a dramatic encounter between the French and Austria troops occurred in Neumarkt in the Summer of 1796. The French barricaded themselves in the city and the Austrians began its complete destruction. Only through the intervention of a smith from Neumarkt, who single-handedly opened the upper gate, was something worse averted. Neumarkt attained the status of Bavarian imperial city, and was the seat of a district court after the Kingdom of Bavaria was formed by Napoleon in 1806.