Learning that the garrison at Harpers Ferry had not retreated after his incursion into Maryland, Lee decided to surround the force and capture it. He divided his army into four columns, three of which converged upon and invested Harpers Ferry. On September 15, after Confederate artillery was placed on the heights overlooking the town, Union commander Col. Miles surrendered the garrison of more than 12,000. Miles was mortally wounded by a last salvo fired from a battery on Loudoun Heights. Jackson took possession of Harpers Ferry, then led most of his soldiers to join with Lee at Sharpsburg. After paroling the prisoners at Harpers Ferry, A.P. Hill's division arrived in time to save Lee's army from near-defeat at Sharpsburg.