After college, Mahon continued his military career. On 18 December 1790, he purchased a lieutenancy in the 47th Regiment. He obtained a captaincy in the newly raised 33rd Light Dragoons in 1794, and transferred into the 32nd Light Dragoons as a major on 26 November 1794. Major Mahon transferred into the 24th Light Dragoons on 30 April 1796, after the 32nd was disbanded. On 1 January 1797, he became a lieutenant-colonel in the 9th Light Dragoons. Mahon was in command of the garrison of Carlow when the United Irishmen rebelled in 1798. When he obtained intelligence of a planned attack by the rebels on the night of 24 May 1798, Mahon set a deadly ambush. Some of the townsmen left the town to join the rebels; after they left, the garrison was dispersed among strong points throughout the town. The rebels were allowed to penetrate without resistance to the Potato Market, only to be met by a withering fire. Many took refuge in houses along Tullow Street, by which they had entered. These were promptly set on fire by the garrison, and the rebels who fled the flames were shot or bayoneted in the streets. The Battle of Carlow had come to an end by the next morning, when from four to six hundred of the rebels lay dead, with no loss to the garrison. Swift reprisals followed: martial law was imposed, and two hundred executions took place shortly after, including that of Sir Edward Crosbie.