The Marquis noted James’ aptitude and offered him a role posing as a runaway slave to infiltrate Benedict Arnold’s camp. As a spy, James reported the activities of Arnold after defection to the British and information gleaned while working as a servant to Lord Charles Cornwallis during the run-up to the siege of Yorktown. James also provided misleading information to the British.

James played an important role in the Battle of Yorktown, providing a warning to Marquis de Lafayette and General Washington on the British plans for reinforcements. Thanks to this information, they were able to plan a blockade to hamper any advancement by the British leading to the major victory by the colonists and the surrender of Lord Cornwallis on October 17, 1783.

The Act of 1783 provided emancipation to slaves who fought in the Revolutionary War, however, James served as a spy, not a soldier and did not qualify. Undeterred, Mr. Armistead continued his fight for James’ freedom petitioning the Virginia Assembly. Upon learning of the situation, Lafayette wrote a letter in support. In November, 1786 Armistead presented his petition with the letter to the legislature who then ordered a Bill be drafted. This was approved and signed by Governor of Virginia in January, 1787. James was given a generous sum for his distinguished service, and a pension.

As a freeman, James adopted the surname Lafayette in appreciation.