OTTAWA -- Canada's spy agency says it has reached a settlement in a discrimination and harassment lawsuit launched by five employees this year.

The Canadian Security Intelligence Service says a mediator helped negotiate a settlement out of court.

CSIS director David Vigneault says the settlement in the best interest of all those concerned.

He says no details will be provided.

The employees alleged in documents filed with the Federal Court that management created a workplace rife with discrimination, harassment and bullying "through its tone at the top."

Last month CSIS asked the court to dismiss the lawsuit, saying it never engaged in or tolerated religious bigotry, used derogatory nicknames or subjected staffers to reprisals.

"I strongly believe in leading an organization where each employee promotes a workplace which is free from harassment and conducive to the equitable treatment of all individuals," Vigneault said in a statement released Thursday.

"Moving forward, the Service will be working to ensure that the behaviour of all employees reflects the CSIS Employee Code of Conduct principles of respect for democracy, respect for people, integrity, stewardship, and professional excellence."

The employees had alleged they suffered years of harassment that was condoned by supervisors. They all said they could no longer work due to depression, anxiety and other ailments linked to the harassment they endured.

One woman alleged that managers had to approve her participation in personal and religious activities after she began wearing a hijab, despite having passed security screening. A gay man with a Muslim partner alleged that a colleague wrote in an October 2015 email, "careful your Muslim in-laws don't behead you in your sleep for being homo."