Democratic U.S. Reps. Edward Markey and Stephen Lynch announced an agreement Wednesday aimed at discouraging outside groups from launching television, radio and internet ads in Massachusetts' special U.S. Senate election.

The deal is based on a similar pledge signed by Republican Scott Brown and Democratic Elizabeth Warren during last year's Senate race. The deal between Markey and Lynch also includes money spent on direct mail advertising which was not covered by the agreement between Brown and Warren.

If an outside group runs an ad, the deal requires the candidate who benefits to donate half the cost of the ad to a charity chosen by his opponent.

After signing the agreement Markey and Lynch both put out press releases saying outside money has no place in the Senate race.

"This election should be focused on issues, not outside-group attack ads," Markey said.

"This race should be decided in debates and on the stump, not by third party advertisements or special interest mailers," Lynch said.

Markey and Lynch urged candidates from other political parties to adopt the same deal.

Earlier Wednesday, the Massachusetts Teachers Association, the state's largest union, announced it was throwing its support behind Markey, prompting Lynch to portray himself as more supportive of President Obama's education agenda.

The teachers union boasts more than 100,000 members in Massachusetts and could give Markey a big assist in helping turn out campaign volunteers and donations in the special election.

MTA President Paul Toner called Markey a "strong and effective advocate for public education and the rights of working men and women."

Toner pointed to what he called Markey's record of backing special education funding, increased online privacy protections for children, programs to fight childhood obesity and fair access to student loans. He credited Markey for being the lead author of a section of a 1996 telecommunications law that has provided federal subsidies to connect schools and libraries to the Internet.

"If Ed Markey is elected, we are confident he will fight as hard for students and public education in the U.S. Senate as he has done in the House," Toner said in a written statement.

The MTA is the state affiliate of the three-million-member National Education Association, which is also backing Markey. Toner said the two associations will be able to organize their members ahead of the April 30 Democratic primary.

Lynch was quick to respond, saying he's the only candidate in the Senate special election who "fully supports President Obama's education reform agenda."

"I have long supported collective bargaining rights for all workers, including public employees," Lynch said in a statement, adding that he will "continue to fight in Congress for expanded early education, teacher training, and a student evaluation system that relies on more than just standardized test scores."

Lynch described himself as a strong supporter of charter schools and said he co-founded the Boston Collegiate Charter School in his home neighborhood of South Boston.

Lynch, who worked as an ironworker for 18 years, has traditionally enjoyed strong support from labor unions during his years in Congress.

Unions could play a key role in an election where there is little time to collect the signatures and raise the cash needed to mount a winning statewide campaign. The most pressing deadline is Feb. 27 when candidates must submit the 10,000 certified voter signatures needed to get on the primary ballot.

Markey and Lynch are the only Democrats to have formally entered the race. Marisa DeFranco, an immigration attorney, is weighing a run as a Democrat.

Norfolk state Rep. Daniel Winslow and Cohasset businessman Gabriel Gomez, a newcomer to state politics, are the only declared candidates on the Republican side. Winslow and Gomez both said they expect to use volunteer and paid gatherers to meet the 10,000 signature hurdle.

Lawyers for Boston Marathon bomber Dzkokhar Tsarnaev rested their case in his federal death penalty trial Tuesday after presenting a brief case aimed at showing his late older brother was the mastermind of the 2013 terror attack.