Ulrika Eleonora of Denmark and Norway (11 September 1656 – 26 July 1693) was Queen of Sweden as the wife of King Charles XI. The name Ulrike is a Danish version of the name; in Swedish she is called Ulrika Eleonora den äldre (English: Ulrica Eleanor the Elder ), to distinguish her from her daughter, the future queen regnant.
Sophia Magdalena was known to be popular with the Caps (party), who were supported by Denmark, while Louisa Ulrika and Gustav sided with the Hats (party). The Caps regarded Sophia Magdalena to be a symbol of virtue and religion in a degenerated royal court, and officially demonstrated their support. 
Second Northern War (1700–21), military conflict in which Russia, Denmark-Norway, and Saxony-Poland challenged the supremacy of Sweden in the Baltic area. The war resulted in the decline of Swedish influence and the emergence of Russia as a major power in that region.