He came here for redemption. At the Clear Lake Evangelical Free Church, Rick Perry held his arms across his torso and swayed as the choir sang during the Sunday morning service. He bowed his head while the pastor preached about “God’s perfect plan of salvation.”

Three years ago, the Texas governor blazed a trail across Iowa to become the instant Republican presidential front-runner. Perry had a solid record and signature bravado. (At the Iowa State Fair, he blew a kiss to the cameras and mockingly said of rival Mitt Romney, “Give him my love.”) But after humiliating fumbles, Perry’s 2012 campaign became a death march: He finished fifth in Iowa’s first-in-the-nation caucuses and dropped out soon after.

This summer, Perry, 64, is back in the game. What he lacks in sizzle from 2011 he’s making up for with newfound substance on issues such as the economy and turmoil in the Middle East. And with tens of thousands of undocumented immigrant children streaming into Texas, the border crisis gives Perry an animating issue placing him at the forefront of Republican politics.

After church on Sunday, Perry spoke about the influx of young immigrants in front of about 100 conservative activists, who sat rapt inside a hot and steamy airplane hangar here. When the governor said the words “securing the border,” he clenched his left fist, flexed his bicep and leaned his body forward. He moved from side to side with a wireless microphone and no notes, bending his knees for emphasis. He looked like a Texas A&M football coach giving the Aggies a pep talk.

“I’ve walked into the facility where these young kids are being held, and the look in their eyes — the lack of hope, they’re scared,” Perry said. “They’ve been lured here by policies put into place that basically said, ‘If you will come here and you cross that river, you can stay here in America.’ That’s a siren song that has to stop.

“I will tell you this,” he added, his voice growing louder. “If the federal government does not do its constitutional duty to secure the southern border of the United States, the state of Texas will do it!”

The activists rose to their feet and cheered. Perry had scored a touchdown. On Monday, when he returned home to Austin, he made another play — ordering up to 1,000 Texas National Guard troops to the Rio Grande Valley.

Perry’s two days of campaigning across rural northern Iowa garnered rave reviews from local conservatives. The Iowa Republican, a blog that promoted Rick Santorum’s candidacy in 2012, wrote of Perry, “The ‘oops’ guy is gone,” a reference to an infamous debate lapse that marked the last gasp of his 2012 bid.

Wells Dickson, 69, who runs a manufacturing business, watched Perry speak in Clear Lake and concluded he had rebounded “from that brain fade.”

“He’s highly intelligent, he’s dynamic and he’s got a great personality,” Dickson said. His wife, Sharon, 66, added: “When you run a state like Texas, you’ve got to be pretty darn smart.”

The immigration crisis has given Perry the opportunity to stare down President Obama — they sat across a table from each other in Dallas earlier this month — and a second chance to make a positive impression with Republican voters.

“This is a new portrait that’s being painted,” said Rep. Steve King (R-Iowa), a vocal opponent of immigration reform.

A ‘wiser’ candidate

Perry’s political rehabilitation has been slow and methodical. There’s little doubt he has become “wiser,” as he put it in an interview here with The Washington Post. Perry said that if he runs for president again — he insists it’s an if, although his actions suggest a when— he will be a competent candidate and as ready as anyone to sit in the Oval Office.

“I try not to be perceived as being coy,” Perry said in the interview. “I am preparing for the possibility of a presidential run. Yes, I think about it, and I know how to be prepared for it.”

In the 2012 race, Perry’s back surgery and a long recovery slowed his campaign. He did not sleep well and often felt pain while standing during long debates. Now, he said, he is healthy. He stopped running and started a regimen of sit-ups, pull-ups, crunches and time on a stationary bicycle.

Perry also shook up his political team, recruiting Jeff Miller, a California-based strategist and lobbyist, to Austin as his top adviser. Miller arranges weekly foreign and domestic policy briefings for Perry. Some of the Republican Party’s leading intellectuals have shuttled to the governor’s mansion to tutor him, while Perry has made regular trips to top think tanks to meet with former secretary of state George P. Shultz, economist John B. Taylor and others.

Since giving up on cowboy boots (the arched heels agitated his back) and wearing hipster glasses, Perry has a look more bookish than buckaroo — and more in keeping with his attempt at intellectual reinvention. He sat on a panel in January with former United Nations secretary general Kofi Annan at the World Economic Forum in Davos, Switzerland. Next month, he flies to China for his second World Economic Forum and is planning a fall trip to England, Poland, Croatia, Romania and the Baltics.

“The biggest error in judgment I made [in 2011] was thinking that just because I’d been the governor in the state of Texas I was prepared to run for the presidency of the United States,” Perry said in the interview. “It is very different in the sense of having a global grasp of what’s going on in the world.”

Perry said he now has the “zeal to learn something new every day,” and jumped from one topic to another during a 30-minute interview. He began by talking exhaustively about his son, Griffin, searching for a college and why he chose to go out of state to Vanderbilt University at the risk of disappointing his Aggie father. He ended it with a detailed discussion of the space investments in rural Texas of Amazon founder Jeffrey P. Bezos, who also owns The Post.

In between, Perry gushed about California. He recently told the New York Times Magazine that he loves the state so much he might move there when he leaves the governorship in January. But in the Post interview, he said, “I was jerking their chain,” and ruled out exiting his native Texas: “No, never.”

Perry and his wife, Anita, are building a home in Round Top, a tiny hamlet between Austin and Houston where some of their friends live. But they will keep visiting California. “My God, what’s not to like about Laguna Beach?” he said. “Holy mackerel. California’s one of the most beautiful places in the world — weather, vistas and wine.”

Appealing to conservatives

Perry clearly is playing to the GOP base, and not just on immigration, which carries long-term risks. After the Texas Republican Party recently adopted a platform supporting “reparative therapy” for gays and lesbians, Perry was roundly criticized for telling business leaders in San Francisco that he thinks homosexuality is a disorder and compared it to alcoholism.If Perry became the GOP nominee, Democrats would attack him over such remarks.

Perry is also positioning himself as a leader of Republican hawks. He picked a fight this month with Sen. Rand Paul (R-Ky.), a leading 2016 hopeful, by writing an editorial in The Post calling Paul’s anti-interventionist foreign policy “a real threat to our national security — to which Paul seems curiously blind.”

Paul snapped back in Politico, writing that Perry’s “new glasses haven’t altered his perception of the world.”

In Iowa, Perry drew a subtle comparison between Obama and Paul, suggesting that the country wouldn’t take a chance again on a young senator who hasn’t run a business or state.

“The same reason I think that whoever sits in the front of the airline that’s carrying me and my family somewhere, I’d like them to be a high-timed, rather experienced, old hand up there,” Perry said in the Post interview.

Republican strategists and advisers to potential Democratic presidential candidate Hillary Rodham Clinton are keeping an eye on Perry’s rise.

“He’s greatly underestimated,” said Stuart Stevens, who was Romney’s chief strategist in 2012. “He’s a big-state governor who’s a conservative who has an ability to unite a lot of elements of the Republican Party. He’s run before, he understands the process, he has been very magnanimous and funny about his missteps.”

‘A little bit of a flirt’

Perry is also learning that political recovery requires patience and drudgery. When he sat atop the polls in 2011, he easily attracted large adoring crowds in Iowa. Last week, it was New Jersey Gov. Chris Christie (R) who saw scores of swooning Iowans and media hordes, while Perry drew just 13 people to a veterans luncheon in Clear Lake.

Still, Perry enjoyed himself. He had his driver stop along a rural highway here so he could take pictures with his aides in a field of corn. The Texans, more accustomed to seeing shades of brown, were agog at the tall green crop.

“His humility stems from a deep Christian faith,” said Robert Haus, Perry’s top Iowa adviser. “We look inward when we make mistakes. . . . When you get punched in the stomach, do you curl up? Or do you get up, learn from the mistakes and get better?”

Perry appeared relaxed as he bantered with voters. At a dinner in Algona, Perry showed two women a video on his smartphone of his granddaughter, Ella, taking her first steps.

“He was a little bit of a flirt,” one of them, Denise Shipler, said admiringly.

Then Perry wandered into the kitchen, past vats of pork loin and potato salad, to pose for pictures with cafeteria workers who sported patriotic aprons for the occasion.

Later, a reporter asked Perry about his black clothes — a look that gives him a passing resemblance to Johnny Cash. “They show wrinkles less,” he said.