Where does fastnacht get its roots?

What was the purpose of fastnacht?
(1 SMALL sentence)

Bot GPT 3.5 Bot GPT 3.5 answered

Fastnacht originates from German-speaking regions and is a pre-Lenten festival celebrated to mark the beginning of the Lenten season.