In 1658, with a regiment of farmers from Helsingør, he twice participated in the defence of Copenhagen. He refused to promise Carl Gustav his loyalty after the Swedish army had occupied Kronborg and was for a while imprisoned but baled out. Together with his wife, he began to smuggle provisions into Copenhagen which was under siege by the Swedish troops. In October 1658, he informed Frederick III about the arrival of Obdam's fleet to the Øresund and began to act as a courier between Obdam and Christoffer Gabel in Copenhagen. In February 1659, he warned the government in Copenhagen about the Swedish plans of an assault on the city and provided it with detailed information about their preparations and dates. Later that spring, together with Lorens Tuxen and Henrik Gerner, he was a central figure in the plans to win back the control of Kronborg. In the forests at Krogerup, he arranged a meeting between the king's servant Corfitz Trolle and the British colonel Hutchinson who supported the plan. He also brought Trolle in contact with Oluf van Steenwinckel and later sneaked him into Kronborg. He received a small Danish army at Krogerup and stationed it with friends in Helsingør. He brought Hutchinson and Steenwinkel the money (1,200 Danish rigsdaler in total) they needed for their participation and escorted Hutchinson's son to Copenhagen as security for his loyalty. When the plan was revealed in June 1659 and many of the involved were arrested, Rostgaard pretended to have died and managed to escape to Copenhagen where he went underground for the next 11 months to protect his wife back in Helsingør.