Gov. Rick Perry of Texas, who often waxes nostalgic about his small-town roots, grew up in an almost all-white rural area where many referred to slingshots as “niggershooters.” One elderly black resident recalls being introduced by her boss at a party decades back as “my maid, Nigger Mae Lou,” while just four years ago, a black high school student found a noose in his locker.

In 1968, Mr. Perry left home for Texas A&M, a deeply conservative university whose yearbooks early in the century included Ku Klux Klan-robed students and a dairy group called the Kream and Kow Klub. The school, having just graduated its first two black undergraduates, was in the early throes of desegregation; at the end of Mr. Perry’s four years there, blacks still made up less than 1 percent of the student body.

By the time he inherited the governorship from George W. Bush in 2000, Mr. Perry appeared to have moved well beyond his racially sheltered background.

One of his early acts was to appoint the first black justice to the Texas Supreme Court. A few months later, flanked by the parents of a black man who had been dragged to death behind a pickup truck, he signed a hate crimes bill that Mr. Bush had blocked. Over his three terms as governor, he has nurtured relationships with black leaders, including the head of the Texas N.A.A.C.P., who extols the governor’s open-mindedness.