His first service was in the Ganges, a small twenty-four-gun frigate. At the time of his entrance into the navy he was of a noble and commanding figure, of captivating manners, and although somewhat impatient in temper, at heart entirely amiable and generous. From the beginning he was remarkable for his kindness and consideration toward his inferiors. When it was necessary to punish the sailors, and Lawrence had to superintend the punishment, his eyes would fill with tears; and when he became a lieutenant, his popularity with the midshipmen was unbounded. It is told of him that once the midshipmen in Commodore Rodgers's squadron determined to give the commodore a dinner, to which none of the lieutenants were to be invited. All were agreed to leave out the lieutenants, when one of the midshipmen cried, "What! not ask Mr. Lawrence!" The impossibility of leaving Lawrence out seemed patent to all of them; and to make the compliment more marked, he was the only lieutenant asked to meet the commodore.
Lawrence's first service in the Ganges was during the troubles with France. The Ganges patrolled the seas, and caught several French privateers which made a good resistance, but never got alongside a vessel of equal force.
In 1802 Lawrence went out to the Mediterranean in the Enterprise, as first lieutenant. This gallant little schooner fully sustained her reputation in the operations of Commodore Morris's squadron, which preceded Commodore Preble's by a year. Although the war had just begun, and had not yet assumed the fierce and determined character of the following year, yet the Bashaw had a foretaste in 1803 of what was to befall him in the way of bombardments and boat attacks in 1804. In one of the boat attacks Lawrence volunteered, and his conduct on the occasion won high praise.
The force was under the command of Lieutenant David Porter, first lieutenant of the New York, flagship, who had already distinguished himself against the French, and was destined to make one of the most daring cruises in the history of navies.
The New York, with the Adams, frigate, and the little Enterprise, began the blockade of Tripoli in May, 1803. A number of merchant vessels, protected by gunboats, ran under the batteries of the old part of the town, where they were comparatively safe from ships of the draught of the American squadron. Every preparation was made to defend them, but Porter, Lawrence, and other brave and daring young spirits determined to make a dash for them and destroy them if possible. Having got the commodore's permission, an attacking party was organized under Porter, with Lawrence as second in command, with three other officers and a number of picked men. On the morning of the attack the boats advanced boldly, in the face of a sharp musketry fire, and succeeded in making a landing. The Tripolitans adopted their usual style of hand-to-hand fighting, but in spite of it the vessels were fired and the Americans retired with slight loss. The Tripolitans, by the most tremendous efforts, put out the fire and saved their vessels; but they discovered that the Americans were disposed to come to close quarters with them, which policy finally brought down the power of the Barbary States.