SYDNEY, Australia — An Australian senator filed a defamation suit on Wednesday against a fellow lawmaker who she says made a sexist remark to her on the Senate floor during a debate about violence against women.

Senator Sarah Hanson-Young, a Greens Party member who was once the youngest woman elected to Parliament, has said that Senator David Leyonhjelm, a Liberal Democrat, told her to “stop shagging men” during a June debate on relaxing import restrictions for pepper spray, a change that advocates say would allow women to better protect themselves.

Mr. Leyonhjelm has acknowledged making the remark.

“The defamatory statements Senator Leyonhjelm made and continues to make are an attack on my character, and have done considerable harm to me and my family,” Ms. Hanson-Young said in a statement, released soon after filing her lawsuit with the Federal Court of Australia in Sydney.

“I’m calling this out because it is wrong,” Ms. Hanson-Young said. “No woman, whether she be working behind a bar, in an office or in the Parliament, deserves to be treated this way, and it needs to stop.”