Ramsay a native of Scotland, born about 1589, was the eighth of nine children of Robert Ramsay of Wyliecleuch. James was nearly related to John Ramsay, viscount Haddington and earl of Holderness. A brother David is noticed separately. James accompanied James VI to England on his accession to the English throne, and was an attendant in the privy chamber of the king and Prince Henry. Subsequently he sought military service abroad and under Gustavus Adolphus. At the battle of Breitenfeld, Ramsay, as eldest colonel, had the command of three regiments of chosen musketeers forming the vanguard. At the capture of Würzburg in October 1631 he headed a storming party, and was shot in the left arm. The wound prevented him from accompanying his regiment during the rest of the campaign and the succeeding year. Gustavus rewarded Ramsay with a grant of lands in the duchy of Mecklenburg and with the government of Hanau.