Lawmakers in the House and Senate have reached agreement on a measure that could pave the way for a severely wounded Air Force bomb-dog handler to adopt her closest comrade in war, a German shepherd named Rex.

Tech. Sgt. Jamie Dana, 26, had just completed a mission in June with Rex when a roadside bomb went off beneath their Humvee in Iraq. Dana suffered extensive internal injuries. In her last conscious moment that day, she pleaded to know if Rex was alive.

Later, as she recovered at Walter Reed Army Medical Center, Dana sought to adopt Rex, who had been burned on the nose but was largely unhurt. Having nearly died herself -- and having believed for a time that her dog was dead -- Dana did not want the two to part ways again. They had worked together three years and also had done a tour of duty in Pakistan.

"He's my best friend," she said in an earlier interview. "I thought he was dead, and I was almost dead, and that made the feeling to be with him a lot stronger."

At first, the Air Force denied Dana's request. Then Air Force officials said they supported the adoption but needed a change in the law, which does not allow for the adoption of working dogs before the end of their useful lives. Rex is 5 years old, well shy of the retirement age of 10 to 14 years.

Under the measure approved Thursday by House and Senate negotiators, military leaders will have the power to waive the standard adoption rules in cases such as Dana's.

That came as good news to Dana's family. Dana was out of town at a horse show with her husband and friends and could not be reached for comment. If the bill becomes law, "she will just be ecstatic," said Sherri Dow, her sister, who lives in Pennsylvania. "That has been the one main goal of hers. . . . That's all she thinks about, day and night."

The measure is part of a $441.3 billion Defense authorization package that conferees are expected to approve Monday. At a time when defense issues are widely debated, John Ullyot, a spokesman for the Senate Armed Services Committee, said the bomb-dog adoption issue was decidedly popular. "It's 100 percent in," he said. "It's a common-sense provision."

Sen. John W. Warner (R-Va.), chairman of the Senate Armed Services Committee -- and a dog owner himself -- spoke with Dana several days ago to let her know he would champion the measure, Ullyot said. Warner worked closely with Rep. John P. Murtha (D-Pa.), Rep. John E. Peterson (R-Pa.) and Air Force Gen. T. Michael Moseley, he said. "Everyone agrees this is the right thing to do," Ullyot said.

The House is expected to vote on the authorization bill Wednesday and the Senate on Thursday. It could go to President Bush as soon as Thursday evening.

Wounded together in Iraq, Tech. Sgt. Jamie Dana does not want to be apart from Rex, whom she called "my best friend."Making exceptions in cases such as that of Tech. Sgt. Jamie Dana and Rex is "the right thing to do," a Senate staffer said.