WASHINGTON — While the Senate has been consumed with a divisive debate over expanded background checks for gun buyers, lawmakers have been quietly working across party lines on legislation that advocates say could help prevent killers like Adam Lanza, the gunman in the Newtown, Conn., massacre, from slipping through the cracks.

Proponents say the plans, which stand a good chance of being included in any final gun-control bill, would lead to some of the most significant advancements in years in treating mental illness and address a problem that people on both sides of the issue agree is a root cause of gun rampages. Unlike the bitter disagreements that have characterized efforts to limit access to guns, the idea of improving mental health unites Republicans and Democrats, urban and rural, blue state and red state.

“This is a place where people can come together,” said Senator Debbie Stabenow, Democrat of Michigan, who has worked with some of the Senate’s most conservative Republicans on a piece of mental health legislation. “As we’ve listened to people on all sides of the gun debate, they’ve all talked about the fact that we need to address mental health treatment. And that’s what this does.”

The issue also appeals to members of Congress in another important way: it serves as a political refuge for Republicans and more conservative Democrats who are eager to offer a federal response to the shootings in Connecticut and Aurora, Colo., but have no interest in taking any action that could be seen as infringing on constitutional gun rights.