Pickett was commissioned a brevet second lieutenant in the 8th Infantry Regiment. He soon gained national recognition in the Mexican–American War when he carried the American colors over the parapet during the Battle of Chapultepec in September 1847. Wounded at the base of the wall, Pickett's friend and colleague Lieutenant James Longstreet handed him the colors. Pickett carried the flag over the wall and fought his way to the roof of the palace, unfurling it over the fortress and announcing its surrender. He received a brevet promotion to captain following this action.