SAN DIEGO (Reuters) - Four U.S. Marines were being investigated on suspicion of committing a hate crime following allegations they beat a gay man outside a bar in Long Beach, California, authorities said on Wednesday.

"We are trying to piece things together, talking to witnesses and looking at video on surveillance cameras," Long Beach Police spokesman Sergeant Aaron Eaton said of the attack, which took place early on Monday.

"Based on some of the language used during the assault, we are investigating this as a possible hate crime," Eaton said.

The four suspects are accused of attacking the man from the bar and then turning on two others who came to the man's aid, Eaton said.

CBS-TV in Los Angeles interviewed a gay film student who said he was attacked at the Silver Fox bar in Long Beach. "I remember blacking out," said the student, who did not want to reveal his identity.

The station reported that witnesses said the Marines had used anti-gay slurs during the beating. The police arrested the Marines at the scene.

The Silver Fox, which plays videos and has karaoke, caters to a mix of gay and heterosexual patrons, Eaton said. The bar advertises several gay-themed events on its website.

A spokesman for the 1st Marine Expeditionary Force at Camp Pendleton near San Diego where the men are based, identified those arrested on suspicion of assault as Lance Corporal Lewis Serna, Private First Class Thomas Pentek, Private First Class Sean Miller and Lance Corporal John O'Leary.

They were released on bail and all returned to their units, said spokesman Major Manuel Delarosa said.

"Committing any hate crime is unacceptable behavior and is not tolerated in the Marine Corps," he said.

The attack comes about a year after the U.S. armed forces began allowing gays and lesbians to serve openly, in a reversal of a "Don't Ask, Don't Tell" policy prohibiting them from revealing their sexuality in effect since 1993.

(Reporting by Marty Graham, Writing by Alex Dobuzinskis; Editing by Cynthia Johnston and Philip Barbara)