Gov. Rick Perry (David Paul Morris/Bloomberg)

Texas Gov. Rick Perry has mastered a critical political skill: Take advantage of your opportunities. First on the border crisis and now on his own indictment, he has shown an uncanny ability to seize the national stage and convey his impressive leadership skills. He is also going a long way toward rebutting the notion that he is a swaggering, not very serious pol — the image that was affixed to him after his disastrous 2012 presidential run.

Unlike the New Jersey bridge scandal, where political wrongdoing was a given and the only question was the governor’s knowledge and complicity, Perry’s indictment is widely seen as a ridiculous political stunt. Most pundits, pols and voters concede that vowing to veto funding for a department unless Travis County District Attorney Rosemary Lehmberg resigned after a drunk driving arrest is commendable, not illegal. Liberal commentators have decried the indictment while conservative media and even potential 2016 opponents have rallied to his side.

Moreover, Perry went on offense quickly. He appeared on Saturday to condemn the indictment, looking defiant and in command. On Fox News Sunday he followed up with a solid performance, decrying this as another example of the rule of law being trampled. He declared, “I had lost confidence in her, the public had lost confidence in her and I did what every governor has done for decades, which is make a decision on whether or not it was the proper use of state money to go to that agency and I vetoed it. I stood up for the rule of law in the state of Texas. If I had to do it again I would make exactly the same decision.”

Rather than play the victim as too many conservatives do when treated unfairly by the media or opponents, Perry is rising to the occasion. Coupled with his attacks on the president for inaction on immigration and dispatch of national guardsman to the border, Perry is stepping out at the Republican willing — and able — to take on liberal incompetence and abuse. This surely will be his 2016 theme if he runs for president.

Even before the spurious indictment, Perry, bespectacled and more sober than his 2012 incarnation, was already showing he was not the candidate who ran last time around. He has been traveling and studying foreign policy, adroitly challenging Sen. Rand Paul’s isolationist leanings and asserting his pro-Israel bona fides. Coupled with his Texas record on growth and jobs, he seems well-positioned for a second run.

He has, it seems, four main challenges in addition to getting the indictment dismissed promptly.

First, he has got to lay out a national message that translates his Texas accomplishments to the country as a whole. What does he want to do on taxes, regulation, education and reform? His anti-Washington message in 2012 had limited appeal; this time his disdain for Washington, D.C., will have to be coupled with an affirmative agenda.

Second, he will need to assure more moderate conservatives and big donors that he can attract independents and even Democrats in the general election. Electability will be a key concern. Like president George W. Bush, he will need to show how he worked with Democrats and practiced inclusive politics both in his choice of advisers and in his policies. (He now touts impressive improvement in high school graduation rates for minority students, for example.)

Third, he could use a defining issue in which his expertise and proposals can set him apart from the field. The natural choice for him (other than his military experience, which no other candidate has) is energy. He has a granular knowledge of the technology and a firm grasp of the economic potential for growth and jobs. Building an agenda — growth, foreign policy leadership and economic opportunity — around energy development may pay dividends.

Fourth, like most conservatives he will need to traverse social issues that keep his natural base among evangelicals intact while not appearing harsh or intolerant to the electorate as a whole. By his own admission he “stepped in it” already with remarks about homosexuals. He is a longtime proponent of 10th Amendment principles, and on gay marriage a “to each his [i.e., each state] own” stance may be the wisest course.

Perry will have a tough time carving a niche in a crowded filed, brushing aside complaints about his record (number of uninsured voters, cronyism in appointments) and avoiding miscues. But to a large extent all candidates will face the same difficulties in defining themselves, fending off attacks on their records and steering clear of potholes. What Perry has done, however, is show what he can bring to the table — tough and calm leadership and national security smarts. In doing so and against all expectations, he is now a top tier candidate for 2016.

Jennifer Rubin writes the Right Turn blog for The Post, offering reported opinion from a conservative perspective.