Why did he write the star spangled banner?

Scott Key wrote the star spangled banner as a symbol of our victory of the wars with the british.