In 1857 Lamar won a seat in the House of Representatives as a Democrat, which he held for three years. But upon the outbreak of the Civil War Lamar immediately resigned and returned home. Initially Lamar had opposed secession by Southern States from the Union, but as war clouds gathered he reversed course, and was ultimately selected to draft Mississippi's secession declaration. Lamar now became one of the most ardent and prominent Confederate voices. Lamar used his wealth and connections to organize the 19th Mississippi Volunteers, which he commanded, seeing action in the Peninsula campaign.

In late 1862, President Jefferson Davis selected Lamar to become the Confederate States ambassador to Russia. Lamar made it as far as Paris before he was recalled, Russia having refused to recognize the sovereignty of the CSA.

After his return from Europe, Lamar served as legal council and political spokesman to Jefferson Davis, worked as a judge advocate in Confederate military trials, and served as an aide to General James Longstreet.

Lamar returned to Mississippi after the war, resuming his law practice and teaching position at the university, directing the law department until 1870. That year Mississippi was readmitted to the Union, and Lamar received a full pardon for his services to the Confederacy. In 1872 he was re-elected to the House of Representatives.

In Congress Lamar worked to repair some of the damage caused in the previous decade by the Radical Reconstructionists, famously calling for amnesty for all former confederates. Tired of the animosity of the radicals, many people in both the North and South supported this position, and it gained Lamar much popularity.