why did francis scott key write the star spangled banner?

A; he had been asked to write a national anthem.
B: he was happy the war had come to an end
C; he thought the americans had surrendered
D: he was inspired by american soldiers

A: he had been asked to write a national anthem.