In late 2013, top strategists at the solar industry's national lobbying group in Washington mapped out a plan to get a critical tax credit passed through Congress.

The 30 percent Investment Tax Credit (ITC), passed as part of the 2008 bank bailout, wasn't set to expire for another three years. But even with the price of solar systems down 50 percent since 2010 and installations hitting record numbers nationwide, companies worried about a looming collapse of demand and a wave of job losses in 2017.

Waiting to extend the credit at the last minute wasn't an option. So the Solar Energy Industries Association (SEIA), an organization with 1,000 member companies across the industry, quietly built a multimillion-dollar campaign to prepare for the moment when Congress finally considered it.

The organization raised member dues and even tapped a $750,000 line of credit to fund the effort.

"Solar had been out of the game for a while after the stimulus win. SEIA made some smart strategic decisions to build a base of support well ahead of time," said a lobbyist familiar with the organization's strategy.

The crux of the campaign: build Republican solar champions.

Only two years before, the collapse of the government-backed manufacturer Solyndra had fueled strong anti-solar backlash among Republican lawmakers. The 2012 presidential campaign intensified the backlash, as the Romney campaign and other conservative groups attacked the Obama administration for its investments in clean energy.

It was hard enough convincing lawmakers to care about a tax credit that wouldn't lapse for another three years. Dodging the political mud-slinging would be an added challenge.

Making SEIA's task harder, the utility industry's main lobbying group, the Edison Electric Institute (EEI), also began lobbying against an extension of the tax credit. In 2013, EEI spent 10 times more money on national lobbying than the solar industry did, according to data from Open Secrets.

SEIA's planned campaign consisted of five components: hire more lobbyists, grow its political action committee and donate to more candidates, work with state chapters to build local support, sharpen communications, and use research to show lawmakers where installation growth and job creation is occurring. (Disclosure: SEIA uses data from GTM Research in the quarterly Solar Market Insight report.)

That last component -- jobs and installation data -- was critical for building support. It became particularly important after the fall of 2014, when Republicans took control of the Senate.

"When the Senate flipped, we started focusing on leadership. Tapping into that kind of [employment] information was essential for developing strong champions," said Rhone Resch, SEIA's president and CEO.

Armed with employment and project data, SEIA targeted Senate Republicans in key committee positions from Georgia, Ohio, Nevada and North Carolina -- states where employment numbers had soared in recent years.

This included Georgia Senator Johnny Isakson, who serves on the Senate Finance Committee; Ohio Senator Rob Portman, who serves on the Senate Finance Committee and the Energy and Natural Resources Committee; North Carolina Senator Richard Burr, who sits on the Senate Finance Committee; and Nevada Senator Dean Heller, also a member of the Finance Committee.

"It was important to get the GOP to take ownership. It was less about targeting supporters and the White House, and more about doing the hard work of building new supporters," said Katherine Hamilton, a partner with 38 North Solutions who lobbied on behalf of SEIA member companies.

In late 2014, Senate Finance Committee Chairman Orrin Hatch, a Republican from Utah, ushered the passage of a tax extenders bill. Senator Heller planned to offer an amendment extending the ITC; however, Chairman Hatch told him that it was too soon to consider, since the credit wouldn't change until 2017.

According to Resch, that prompted "a Republican agreement to take care of solar" in 2015 or 2016 when the tax credit came up again.

In May of 2015, activity started in the House. California Democrat Mike Thompson, a representative from California, introduced a bill extending the ITC for five years. It had dozens of co-sponsors. The bill wasn't expected to go anywhere, but it was a helpful benchmark for future negotiations.

Meanwhile, SEIA started ramping up its lobbying power. The organization hired three well-connected Republicans through the law firm Squire Patton Boggs.

Trent Lott, the former Republican Senate Majority Leader and House Whip, was one of them. SEIA also hired David Schnittger, who had served as a senior staffer in House Speaker John Boehner's office for two decades, and David Hoppe, who most recently became chief of staff for Paul Ryan, the newly elected House Speaker.

With disciplined messaging around jobs and a strong lobbying presence, negotiations started moving quickly in the fall.

In early October, House Republicans passed a bill eliminating the 40-year ban on oil exports. While the controversial proposal didn't have enough support from Democrats in the Senate, North Dakota Democratic Senator Heidi Heitkamp proposed linking long-term extensions of renewable energy tax credits to the ban. That provided an opening for groups lobbying for wind and solar tax credits.

The week after Thanksgiving, SEIA flew a group of 15 executives from leading solar companies to Washington to directly lobby members of Congress. The oil export ban would be their best shot to get an extension in 2015, and they made a year-end blitz to get credit extensions at the top of the agenda.

The pieces started falling into place after Paul Ryan replaced John Boehner as House Speaker in October. "Paul Ryan stepping into that leadership role created a scenario where a bigger deal could happen," said Resch.

Under pressure to pass a spending bill -- and determined to find compromise between warring parties -- Speaker Ryan helped broker a $1.1 trillion omnibus that funded the government for one year. In exchange for leaving out amendments defunding Planned Parenthood and restricting Syrian refugee resettlement, Republicans kept an amendment lifting the ban on exports of domestic crude oil.

Democrats wanted even more in return. Following the earlier suggestion of Senator Heitkamp, multi-year extensions of tax credits for wind and solar were added to both bills in the House and Senate. There was no room for compromise on the issue, said Democratic leaders.

"We have 2 paths: 1. Pair oil export ban with policies to reduce carbon emissions; 2. Pass gov't funding without oil/renewables," tweeted Senator Harry Reid, after the bill was unveiled.

Even with the deal, Speaker Ryan and House Minority Leader were unsure if they had enough votes. In the end, however, the bills had more than enough support to pass in the House and the Senate -- giving advocates of wind and solar credits a big win as Congress adjourned for the rest of 2015.

Many factors aligned all at once to make the deal possible, but limited Republican opposition to the credits was one reason the bill moved forward. That was a notable change from the two years after the Solyndra bankruptcy, when the GOP shunned any government support for renewable energy.

One of the reasons was the campaign to build Republican support for the ITC.

"The conversation we have today is materially different from 2012. There are a lot more Republican members of Congress who see that solar is an economic engine in their states, who are actual champions," said Resch. "No one brings up Solyndra anymore."