Francis Scott key wrote the spangled banner during?

He wrote the star spangled banner whilst in custody on HMS Minden, during the Anglo-American war of 1812, after witnessing the bombardment of Fort McHenry.