Who wrote the Star Spangled Banner and during what battle?

Francis Scott Key wrote the Star Spangled Banner during the bombing of Fort Mchenry