As super PACs and heavily funded national organizations pour millions into elections across the country, candidates in two Senate races are trying to put an end to the tidal wave of third party ads from groups they cannot coordinate with, converse with or control.

But in both Montana and Massachusetts, the Republican candidates' pledges to ban advertising from outside groups were written by the very type of outside group they were seeking to ban.

Sean Cairncross, a top election lawyer for the National Republican Senatorial Committee, which helps elect Republican candidates to the Senate, is listed as the author in the electronic signature of the letters both Montana Rep. Denny Rehberg and Massachusetts Sen. Scott Brown sent to their opponents.

Rehberg's letter, which he sent on Friday, called for him and his opponent Sen. Jon Tester to sign a "Made in Montana Pledge" to reject any money from outside Montana, refund any out-of-state money already received and block third party advertising in their race.

Chris Bond, Rehberg's campaign spokesman, said it would have been "simply irresponsible" not to seek the advice of an election law expert when creating a legally binding campaign finance agreement. Bond said Rehberg and his campaign drafted the pledge and then sought "advice and feedback" from Cairncross.

"As we began drafting this ground-breaking proposal, which Tester refused to sign because he didn't want to part with his lobbyist and special-interest PAC money, it should come as no surprise that we sought the advice of an election law expert," Bond said.

Rehberg's pledge was a stricter version of a pledge Tester sent last week requesting that both candidates reject only third party advertising. Murphy said Tester's pledge was his own idea and was written entirely by Tester and Murphy.

"Congressman Rehberg asked Washington lawyers to do his work for him, then tried to tell everyone his pledge was 'made in Montana?'" Tester's spokesman Aaron Murphy said. "It's yet another lie, and it's exactly why Montanans can't trust Dennis Rehberg."

In Massachusetts, Brown's letter laid out the stipulations of a "People's Pledge" that he and his chief rival Elizabeth Warren signed to eliminate spending and advertising from third party groups and Super PACs in their hotly contested senate race.

While the irony of using a third party group to write a pact banning third party groups is unmistakable, the reasoning is more straightforward. Election law is a tangled web of legalese, legislation and Supreme Court rulings where the lines are fine and the penalties are severe.

With some of the best election law experts in the country employed by the national parties, Brian Walsh, a spokesman for the NRSC, said the coordination "shouldn't surprise anyone."

"As with our Democratic counterparts, the NRSC provides advice and counsel to all of our campaigns," Walsh said. "It would be surprising if they did not seek advice from election law experts within their party, particularly when opponents present them with legally binding agreements."

But Murphy said the Montana pact, which Tester and Rehberg were unable to agree on, was not about creating a legally binding document.

"For us it wasn't about putting forward a legal document," Murphy said. "In Montana your word is your bond and a handshake goes a long way."