In what country was the sport of curling invented?

In what country was the sport of curling invented?