When it comes to getting married, there are tons of different phrases that people use in everyday speech to signify it, from “getting hitched” to “walking down the aisle.” The meaning behind many of these commonly-used idioms is clear, but some expressions—like “tying the knot,” for example—are more obscure in origin. Here’s how we got “tying the knot.”

It relates to the ancient ritual of handfasting, a tradition practiced in Hindu Vedic communities, as well as by the ancient Mayans and the Celts in Scotland. In Scotland, the ceremony was mainly held outdoors, with couples inching closer to one another as their hands were tied together with ribbons or cords. There were a number of ways a couple could be bound, including having a knot tied after each vow.

While this rite was popular throughout the Middle Ages, handfasting was seen as a symbol of betrothal, not actual marriage. Some believe that the act symbolized the start of a trial period, which would last for exactly a year and a day. If, after that span of time, the couple still liked one another, they would have a second ceremony to officially seal the deal.

Handfasting rituals were recognized as legally binding in Scotland (in lieu of church weddings) until the passing of the Marriage (Scotland) Act in 1939, according to BBC. In 2004, the country changed course, accepting it as a legally valid form of matrimony once more, when performed by a licensed officiant. Today, handfasting ceremonies still happen all around the world and are steeped in romance and tradition.