Sen. Lamar Alexander, chairman of the Senate Health, Education, Labor and Pensions Committee, sits next to the committee’s ranking Democrat, Sen. Patty Murray, at the start of a hearing on No Child Left Behind on Capitol Hill on Jan. 21. (Susan Walsh/AP)

Sen. Lamar Alexander walked into Sen. Patty Murray’s office and closed the door.

Alexander, a Republican from Tennessee, had just taken control of the education committee in the new GOP-led Senate and was determined to rewrite No Child Left Behind, the main K-12 federal education law. It was early February, and he had released a draft of his ideal bill, inviting lawmakers to amend it with their own ideas in committee before bringing it to the full Senate.

Murray, the committee’s ranking Democrat from Washington state, was equally serious about crafting a new law. But she bluntly told Alexander that his way wouldn’t work.

Using a Republican draft as a starting point would only lead to yet another partisan logjam that has come to define Congress, and it would doom their chances of passing an education law that was eight years overdue, she said.

As their staffs anxiously waited in an ante room, Murray and Alexander made an old-school deal —they would find common ground and together write a bipartisan bill. They would compromise.

Alexander and Murray arrive on Capitol Hill for a committee hearing to look at ways to reform the No Child Left Behind law. (Susan Walsh/AP)

“I know the general atmosphere of Congress today is ‘Whatever they do is bad’ and ‘Whatever they do is bad’,” Murray said in an interview. The only way to slice through that dysfunction, she said, is to start with a “document at the outset that both of us said we could support and live with and work from.”

It wouldn’t be easy, she told Alexander. “It takes really listening to each other, working it, member by member, line by line, idea by idea,” she said.

Alexander, 75, and Murray, 64, had never worked closely but they were suited to the task. Murray had a growing reputation as a dealmaker after negotiating a budget with Rep. Paul Ryan (R-Wis.) in 2013; Alexander had stepped down from Republican leadership in 2011, saying he wanted to focus on bridging divides rather than scoring political points.

Alexander accepted Murray’s suggestion.

“And it turned out to be good advice,” he said later in an interview. “I gave up something, but I gained more — not only a working relationship with her but a lot of support from the Democratic members of the committee.”

The result was remarkable. On a Senate committee that spans the political spectrum from progressive Elizabeth Warren (D-Mass.) on the left to tea party favorite Bill Cassidy (R-La.) on the right — and includes two declared presidential candidates — the bill Alexander and Murray wrote sailed through on a unanimous vote. The full Senate overwhelmingly approved it 81 to 17.

“It’s an extraordinary accomplishment,” said Tom Daschle, the South Dakota Democrat and former Senate majority leader who founded the Bipartisan Policy Center.

It was a throwback to the way Congress once operated, said Mary Kusler, lobbyist for the National Education Association, the largest teachers union.

“It’s such an odd, odd thing to see that happening in the way it used to happen all the time,” said Kusler, who closely watched the process play out over six months. “Which was essentially that members ofCongress, senators and members of the House, kind of moved from their corners into the center to meet each other.”

Their 601-page bill dealt with the role of the federal government in the nation’s 100,000 schools and touched a number of hot-button issues, including standardized testing, school vouchers, protections for gay and transgender students and how the federal government allocates billions of dollars to schools.

“It was a very complicated piece of legislation with crocodiles lurking every 100 yards,” said Alexander, a former governor, university president and U.S. secretary of education under President George H.W. Bush.

Alexander and Murray each had to navigate conflicts within their own parties over education policy, and Murray carried the extra weight of also representing the interests of the Obama administration.

They convinced committee members to save controversial amendments for debate before the full Senate, fearing that if political arguments consumed the committee, the bill would never make it to the floor.

That meant Sen. Tim Scott (R-S.C.) withdrew an amendment to allow federal tax dollars to be used to pay tuition at private schools, while Sen. Al Franken (D-Minn.) withdrew his proposal to extend federal civil rights protection to gay, lesbian and transgender K-12 students. Both later were introduced on the Senate floor during full consideration of the bill; neither got enough votes to pass, but the lawmakers felt gratified that they had an opportunity to make their arguments.

One issue that nearly derailed the deal was early childhood education.

Murray, a one-time preschool teacher, insisted that the bipartisan bill include some provision for preschool for low-income children, a top priority of hers as well as the Obama administration. Alexander and Senate Republicans are opposed to any expansion of the federal role in education.

“From the start, he told me ‘no way,’ ” Murray said. “And I brought it up every minute, every time, every day.”

They had a final standoff in early March inside Murray’s hideaway, a private office in the U.S. Capitol with a view of the Supreme Court.

“They just had very different views about what was appropriate and what was the right thing to do,” one Republican staffer said, speaking on condition of anonymity to discuss private negotiations. “I remember looking out her window and thinking, ‘this is where this bill dies.’ ”

Then Alexander got an idea. If Murray could work out a preschool proposal with Sen. Johnny Isakson (R-Ga.), a committee member she knew and had worked with in the past, Alexander said he would accept it. If Isakson signed on, Alexander knew it would get some support among Republicans. That enabled Alexander to “not own it, but to allow it, in a bipartisan way,” Murray said.

Murray and Isakson wrote an amendment that would create competitive grants for states to help them coordinate various state, federal and local early childhood programs. The amendment was adopted by the committee and added to the bill. It wasn’t as strong as Murray wanted, but it was something, she said.

“If you walk into any piece of legislation, I don’t care if it’s the budget with Paul Ryan, or this, or workforce investment or anything else I’ve ever worked on, if you say these are my words, not one of them is going to change until signed by the president, you’re in the wrong business,” she said.

Later, Sen. Bob Casey (D-Pa.) introduced a more robust early childhood proposal that would have provided universal access to preschool for low-income children, but it got just 45 of the 60 votes needed for passage on the Senate floor.

During the weeklong debate, Alexander and Murray worked as a team, alerting each other if there was a lawmaker within their own caucus with an objection and brainstorming a way to resolve it.

“We were careful not to surprise each other,” said Alexander, who tried to follow the example from the 1980s of the working relationship between Howard Baker and Robert Byrd, two of the Senate’s statesmen. “You don’t succeed if you spend your time or your staff’s time trying to make each other look bad.”

Trent Lott, the former Republican Senate majority leader from Mississippi, said Alexander and Murray are “right up there at the top.”

“Lamar is probably one of the best Republicans that I know, he knows how to make things work in the Senate,” Lott said. “And for the Democrats, I conclude that Patty Murray is probably their best legislator.”

Their bipartisan approach stands in stark contrast to the way the House handled its rewrite of No Child Left Behind. House Republicans barely passed a partisan bill on July 8 — 218 to 213 — without a single vote from Democrats. President Obama has threatened to veto the House bill, largely due to a provision that would change the way federal dollars are distributed in a way the White House says will hurt poor schools.

Pragmatism drives the difference. In the GOP-controlled House, Republicans can pass bills with a simple majority and don’t need Democrats. But Senate rules require 60 votes to pass legislation, which means Republicans need at least a handful of Democrats to pass anything.

Now, Alexander and Murray have to negotiate a compromise bill with House leaders that can pass both chambers and earn the president’s signature.

“It’s not really brain surgery,” Alexander said. “It’s basic human relations, listening to other people, accepting their ideas and asking them to help you work towards a result.”

The pair intend to move otherpending legislation that has the potential to affect millions of Americans, including a reauthorization of the Higher Education Act and a bill to spur innovation at the Food and Drug Administration and the National Institutes of Health.

Alexander and Murray celebrated the passage of the K-12 education bill by exchanging bottles of wine.

And then they made an appointment to get back to work.