King Harald Fairhair is the monarch who is credited by later tradition as having first unified Norway into one kingdom. According to the sagas, he ruled Norway from approximately 872 to 930. Modern historians, including Claus Krag, assume that his rule may have been limited to the coastal areas of western and southern Norway. The tendency in recent research has been to perceive unification of the nation to have been a more time consuming process.
The sagas tell us that Harald succeeded, on the death of his father Halfdan the Black Gudrödarson, to the sovereignty of several small, and somewhat scattered kingdoms in Vestfold, which had come into his father's hands through conquest and inheritance. In 866, Harald made the first of a series of conquests over the many petty kingdoms which would compose Norway, including Värmland in Sweden, and modern day south-eastern Norway, which had sworn allegiance to the Swedish king Erik Eymundsson. In 872, after a great victory at the Battle of Hafrsfjord near Stavanger, Harald found himself king over the whole country. 
His realm was, however, threatened by dangers from outside, as large numbers of his opponents had taken refuge, not only in Iceland, then recently discovered; but also in the Orkney Islands, Shetland Islands, Hebrides Islands and Faroe Islands. His opponents' leaving was not entirely voluntary. Many Norwegian chieftains who were wealthy and respected posed a threat to Harald; therefore, they were subjected to much harassment, prompting them to vacate the land. In time, Harald was forced to make an expedition to subdue these islands.
After Harald's death, the unity of the kingdom was not preserved. In following centuries, the kingdom was variously ruled, wholly or in part, by descendants of King Harald or by earls under the suzerainty of Denmark. Kings of Norway until King Olav IV, who died in 1387, commonly claimed descent from Harald Fairhair.
In the Saga of Harald Hårfagre from Heimskringla by Snorri Sturluson, the consolidation of the rule of Norway by Harald Fairhair was somewhat of a love story. The tale begins with a marriage proposal that resulted in rejection and scorn from Gyda, the daughter of Eirik, king of Hordaland. She said she refused to marry Harald "before he was king over all of Norway". Harald was therefore induced to take a vow not to cut nor comb his hair until he was sole king of Norway, and that ten years later, he was justified in trimming it; whereupon he exchanged the epithet "Shockhead" or "Tanglehair" for the one by which he is usually known. Most scholars today regard this story as a literary tale inspired by the Romance stories that were popular at the courts by the time Heimskringla was written.