When in 1648 the Peace of Westphalia ended the Thirty Years' War, the parties agreed that the prince-bishoprics of Bremen and Verden were to become dominions of Sweden. The peace treaty had been prepared at a congress throughout the final years of the war. During the negotiations, several mostly Hanseatic cities requested that they become Imperial cities, with only Bremen being successful: Ferdinand III, Holy Roman Emperor accepted Bremen as a Free imperial city in 1646. A respective document was signed in Linz on 1 June, with the aim of preventing Sweden from gaining the city. In turn Bremen, among other concessions, paid about 100.000 talers. Owing to Swedish diplomatic efforts however, the text of the 1648 treaty did not determine whether or not Bremen was to be included in the future Swedish dominion. The Prince-Archbishopric of Bremen, northerly and easterly neighbouring the city's territory, had been occupied by Sweden since 1646/47. Swedish forces had then expelled the forces of Prince-Archbishop Frederick II, Prince of Denmark, officiating from 1637 to 1648. On 18 February 1647, the emperor accepted Sweden's annexation of the prince-archbishopric's territory as a secularized duchy. After the war a dispute about custom collection between Bremen and the emperor led to the latter imposing an Imperial ban on the city in 1652/53. Sweden, which had never accepted Bremen's Imperial immediacy, attacked in 1654.
Question: What happened first: the Thirty Years' War or the Peace of Westphalia?
Answer: the Thirty Years' War