Researchers now have a better understanding of how one popular beer style was created.

Early lagers were likely created at a royal court brewery for Maximilian the Great in 1602, according to a article. A study recently published in the journal FEMS Yeast Research contains the findings of a group of German researchers, which points to the origin of a budding yeast species needed to produce lager.

The birth of modern-day lager, it appears, was specifically sparked by a change in the royal lineage. Maximilian the Great came into power on the Bavarian court after Hans VIII von Degenberg didn’t produce an heir. Maximilian the Great then oversaw brewery production at a Schwarzach brewery, and yeast from this brewery was brought to a royal brewery in Munich and crossbred to create the hybrid lager yeast.

From there, lagers brewed with this key hybrid were born. It’s believed that the hybrid and lager production process then spread to breweries across the continent — and eventually, the world.

While there’s clear evidence of beer production for centuries prior, those brews were overwhelmingly classified as ales. At some point in history, brewing shifted from primarily producing ales to lagers, the most popular type of beer consumed today.

That transition is marked in the late middle ages by the introduction of a new hybrid yeast, Saccharomyces pastorianus (“lager yeast”). Prior research hasn’t pinpointed exactly when this hybrid (a combination of ale yeast and another cold-tolerant species) originated, but the common belief is that a wild species of cold-tolerant yeast “contaminated” beer made with the ale strain.

In this recent study, the group of German researchers discovered through historical records that this hybrid yeast was being used in Bavaria some 200 years earlier than previously believed. They hypothesized, instead, that the ale strain was added to beers brewed with the cold-tolerant yeast.

Using primary sources from the time period, the team traced this phenomenon to a brewery in Schwarzach, Bavaria. A beer ordinance from 1516 detailed regulations on brewing — including a rule that only allowed “lager-style” beer created with bottom fermentation. Nearby in Bohemia, breweries historically created wheat beer with the cold-tolerant species of yeast. This beer was often imported into Bavaria.

“There is a certain irony that the inability of Hans VIII von Degenberg to produce a son triggered the events that led to the creation of lager yeast,” a lead study author, Mathias Hutzler, says. “As one lineage died out, another began. No heir—but what a legacy he left for the world!”