The precise date of the city's founding is unknown, but its founding as "neuer Markt" is assumed to have happened in the beginning of the 12th century, on the trade route between Nuremberg and Regensburg. The city was first mentioned in a document in 1135, and city fortifications were mentioned for the first time in 1315. In the 13th century Emperor Frederick II granted Neumarkt "Reichsfreiheit", and with it, the right to collect customs on trade between Nuremberg and Regensburg and itself. However, the city never enforced this status, because the city fell to the Wittelsbachs in 1329 through the Treaty of Pavia.