By Lawrence Hurley

WASHINGTON (Reuters) - The U.S. Supreme Court on Monday agreed to decide whether immigrants detained for more than six months by the U.S. government while deportation proceedings take place are eligible for a hearing in which they can argue for their release.

The decision by the justices to hear a case focusing on the rights of people flagged for deportation comes during a presidential election campaign in which immigration has been a hot topic.

The court agreed to hear an Obama administration appeal of an October 2015 ruling by the San Francisco-based 9th U.S. Circuit Court of Appeals that upheld a lower-court injunction requiring a hearing after six months of detention.

The long-running class action litigation brought by the American Civil Liberties Union includes some immigrants who were held at the border when seeking illegal entry into the United States and others, including legal permanent residents, who have been convicted of crimes.

If the immigrants were granted a bond hearing, the government would have to show they are flight risks or a danger to the community in order for the detention to continue.

The Justice Department said in court papers that the appeals court decision was "fundamentally wrong" because it dramatically expanded the number of people eligible for hearings and set a high bar for the government to argue that a detainee should not be released.

The ACLU responded in its court papers that the government had exaggerated the impact of the court injunction, which has been in place since 2012 and applies only to immigrants in the Los Angeles area.

Since it has been in effect, there has been "no evidence of adverse effects on immigration enforcement," the ACLU lawyers said.

The court will hear oral arguments and decide the case during its next term, which starts in October and ends in June 2017.

In one of the biggest cases of its current term, the Supreme Court is due to decide by the end of the month whether to reinstate President Barack Obama's 2014 executive action to shield millions of immigrants in the country illegally from deportation. The plan was blocked by lower courts.

(Reporting by Lawrence Hurley; Editing by Will Dunham)