Rally round the flag

Looking for the origin of "rally round the flag".

There is a Civil War song that contains that phrase. See en.wikipedia.org/ wiki/Battle_cry_of_freedom

Also, Mr. Safire says, in a long entry about "rally" (from the French "rallier," to join again, to reassemble scattered troops to fight again) that "'Rally around the flag' may or may not have been said by General Andrew Jackson at the Battle of New Orleans..." From Safire's New Political Dictionary by William Safire (Random House, New York, 1993). Page 643-645.

The phrase derives, I believe, from the days when a flag was carried into battle, and when things became totally confused in the noise, the smoke and so on, it provided a point around which the soldiers could rally in order to regroup.

DFG