The two leading contenders for the Republican presidential nomination — Texas Gov. Rick Perry and former Massachusetts Gov. Mitt Romney — have cast themselves as foot soldiers in the war against government workers.

Romney has criticized President Obama for presiding over an “unparalleled” expansion of the federal workforce that he would see rolled back, while Perry has insisted altogether that it’s not the place of government to create jobs.

Yet both men have presided over substantial additions to state government payrolls at taxpayer expense during their tenures as governor, a review of historical employment data found.

When Romney took office in January 2003, the Massachusetts state government employed 112,000 workers, according to the state Department of Labor and Workforce Development.

Four years later, the ranks of Massachusetts state employees had grown by 3,000, or a 2.6 percent increase. (Over the same period, nonfarm employment grew just 1.2 percent.)

During Perry’s decade-long tenure in Texas, the state workforce has also blossomed, climbing from 328,800 in December 2000 to more than 377,600 in July 2011, a net gain of 48,800 state government jobs, according to the Texas Workforce Commission.

The more than 14 percent expansion of Texas state government under Perry far outpaces private sector job growth of 9.7 percent in the state over the same period.

As for Obama, the ranks of the federal government have swelled during his administration, though not by significantly more than they did under his predecessor, George W. Bush.

Between January 2009, when Obama took office, and August 2011, the federal government has added a net 137,000 jobs, or a 6.6 percent expansion of the workforce. During Bush’s second term, the ranks grew by 114,000 jobs, or 5.8 percent.

More than 2.2 million Americans worked for the federal government as of August 2011, excluding postal workers.