Answer
Sweden gained control of Bremen as a result of the Second Northern War against Denmark–Norway that lasted from 1655 to 1660. Frederick III, the King of Denmark and Norway, was defeated and forced to cede the city and its adjacent territories to Sweden in the Treaty of Roskilde signed in 1658, marking a significant loss for Denmark and a territorial gain for Sweden in the region.