German mediatization
Thus, Sandhausen became part of Bavaria. It was occupied by French troops in 1795 and was awarded to Grand Duchy of Baden after German mediatization in 1803.