Troy King replaces Bill Pryor, who resigned last month to take a temporary seat on a federal appeals court.
The 35-year-old King takes over the $163,000 a-year job as Alabama's top law enforcement officer.
In considering candidates to replace Pryor, the governor was looking at people who would be willing to run for a full term in the 2006 elections.
King is no stranger to politics. The Elba native ran unsuccessfully for secretary of state in the Republican primary in 2002 and worked in Spencer Bachus' unsuccessful campaign for attorney general in 1990.
From 1995 to 1999, King worked in Governor Fob James' legal office and served as deputy executive secretary. He worked in the attorney general's office from 1999 until he joined Riley's staff in January 2003 as legal adviser.