Joel Edgerton has revealed how he was “terrified” over perfecting his Boston accent in Black Mass, after a border force officer warned him to “not to f**k up”.

The Australian actor sports a South Boston accent to play former FBI agent John Connolly in Scott Cooper’s biopic about gangster James “Whitey” Bulger, portrayed by Johnny Depp.

Joel Edgerton as John Connolly in Black Mass
Joel Edgerton as John Connolly in Black Mass (Warner Bros)

“I was terrified. I was coming into America from Canada and this border control guy was stamping my passport,” he recalled.

“He knew I’m an actor and he was like, about the accent and the story itself, ‘You better get this right. Don’t f**k this up’. He even called out to me as I was leaving.”

Joel, who has starred in Star Wars Episode III: Revenge Of The Sith, Zero Dark Thirty and The Great Gatsby, admitted he didn’t know much about the story of Bulger – also known as Jim – before he agreed to his involvement in the crime thriller.

Former FBI agent John Connolly
The real former FBI agent John Connolly (Olivia Gatti/AP)

The 41-year-old actor said: “I didn’t really know much about any of them. I first became familiar with the story when they caught Jim Bulger in Santa Monica.

“The fact he’d been on the run for 16 years, that’s when I started to read about it. Later, when the movie landed on my desk, I started diving into John Connolly.”

Joel said he decided not to meet the real John, who was convicted of racketeering, obstruction of justice and murder charges stemming from his relationship with Bulger.

“I had lots of research material, I never met him. I didn’t think that was a fair thing to do considering he disagrees with what he really did… so out of respect, I wouldn’t meet him,” he explained.

“The most accurate and poignant things to help me build the character were things said to me by other FBI agents – one of which was that John was many different faces and he could be whatever he needed to be with whoever he was with.”

Johnny Depp and Joel Edgerton in Black Mass
Johnny Depp and Joel Edgerton in Black Mass (Warner Bros)

Joel said working with co-star Johnny was “a gift”.

“I hung out with him before the movie, and with Scott. It was Johnny with his hats and his jewellery and tattoos,” he said.

“Down comes the Suburban (SUV), and out steps Jim Bulger, (or) Johnny as Jim. It was like a completely different person. That’s who I spent my time with for the three months of the shooting. It was kind of chilling.”

Black Mass is in cinemas now.