James “Whitey” Bulger’s lawyer insisted Wednesday that the gangster was never an FBI informant, yet remains determined to prove his assertion that a former federal prosecutor promised him immunity for all of his crimes, including murder.

“James Bulger was never an informant for the FBI or anyone else at any time, and it was not the reason why he received immunity,” Boston lawyer J. W. Carney Jr. told reporters following a hearing on Bulger’s ­immunity claim.

Bulger’s assertion that he was not an informant is contradicted by FBI files and court testimony indicating he was an informant from 1975 to 1990 and provided information about his rivals in the ­Mafia and members of his own gang.

When pressed about why the government would grant immunity to Bulger if he was not providing information, ­Carney said only, “We’re going to present that answer when the trial starts on June 10. If you want to know what the ­answer is, be there.”

During Wednesday’s hearing in federal court in Boston, Carney argued that Bulger has a right to ask the jury at his trial to decide his asser­tion that a deceased former federal prosecutors promised him immunity decades ago.

Prosecutors argued that Bulger has offered no proof of his immunity claim, which should be decided by the judge before trial. US District Judge Richard G. Stearns took the matter under advisement.

Bulger, 83, was captured in Santa Monica, Calif., in June 2011, after more than 16 years on the run. He is being held at the Plymouth County Correctional Facility while awaiting trial on a sweeping federal racketeering indictment charging him with participating in 19 killings in the 1970s and 1980s.

Relatives of some of the people allegedly killed by Bulger scoffed at his claim to be ­immune from prosecution.

The niece of Arthur “Bucky” Barrett, an expert safe-cracker who was allegedly robbed and killed by Bulger in 1983, called the immunity assertion “sick” as she stood outside the courthouse holding a photograph of her uncle. “They will not be able to prove he had immunity today, tomorrow, or next week,” said Sandra Patient of ­Manchester, N.H.

Robert Fitzpatrick, a former assistant special agent in charge of the FBI’s Boston bureau, said during a telephone interview with the Globe on Wednesday, “I think what’s ­going on now is he doesn’t want to be labeled an informant because his brother hates informants; everybody hates informants in Boston, particularly the Irish, and he was an informant. That’s a stain.”

But, Fitzpatrick conceded that Bulger was upset in 1981 when he met him at his Quincy condominium and told him he was there to assess whether he was providing valuable information to the FBI or should be dropped as an informant.

Fitzpatrick, coauthor of ­“Betrayal,” a book published last year about the FBI’s mishandling of Bulger, said Bulger snapped, “I’m not an informant.’’

“I told him that he was an informant,” said Fitzpatrick, who said he believed it was a matter of semantics.

Former FBI agent John J. Connolly Jr., who is serving a 40-year prison term for a 1982 murder that Bulger is also ­accused of, told the Globe in 1998 that Bulger considered himself a “strategist.”

During a jailhouse conversation with his brother, John, last September, which is detailed in court filings, Bulger said that Connolly wrote reports that made it look as if he was feeding the FBI information.

Bulger says he was given ­immunity by Jeremiah T. ­O’Sullivan, the former federal prosecutor who led the New England Organized Crime Strike Force and was lauded for spearheading the prosecutions that dismantled leadership of the local Mafia in the 1980s.

O’Sullivan, who died in 2009, denied giving Bulger ­immunity when testifying during a congressional hearing years earlier. But, he acknowledged that he decided not to ­indict Bulger and his partner, Stephen “The Rifleman” ­Flemmi, in a 1979 race fixing case after the FBI told him the pair were informants.

Flemmi, who was indicted with Bulger in 1995, unsuccessfully tried to get his racketeering case dismissed by arguing that the FBI promised him and Bulger immunity for their crimes, with the caveat that they not kill anyone.

After holding yearlong hearings, US District Chief Judge Mark L. Wolf ruled that the pair had tacit approval to commit some crimes, including gambling and loansharking, but there was no formal immunity agreement.

On Wednesday, Anthony Cardinale, a ­Boston lawyer who pushed to have Bulger and Flemmi’s ­informant files made public while representing a codefendant in the racketeering case, called Bulger’s statement that he was not an informant and was given immunity “complete gibberish.”

“All you have to do is look at his rat file, and that stuff wasn’t made up,” Cardinale said. “He’s discussing things that had happened and were going to happen. It’s a bizarre claim that he was not an informant, but somehow he has an immunity claim. . . . What is the basis for it? Why would someone say, ‘Yeah, go and kill everyone.’ ”

Assistant US Attorney ­Zachary Hafer contended in court Wednesday that O’Sullivan did not have the authority to give Bulger immunity for killing American citizens and urged the judge to hold a hearing on whether Bulger can raise immunity as a defense at trial.

But Carney said Bulger would be denied his right to a fair trial if he is not allowed to take the stand and present his immunity assertion to a jury.