LOS ANGELES (AP) — Josh Brolin thought he was just being goofy when he launched into a Tommy Lee Jones impersonation on a night out with the Coen brothers and their pal Barry Sonnenfeld. Turns out, Brolin was on an audition of sorts.

Four years later, Brolin shows his Jones act to the world in Sonnenfeld's "Men in Black 3," playing a young version of Jones' Agent K opposite Will Smith's Agent J as the sci-fi comedy franchise returns after a 10-year break.

After the Directors Guild Awards in 2008, Brolin went out on the town with Joel and Ethan Coen, who had just won the top honor for "No Country for Old Men," their crime thriller that co-starred Jones and Brolin. Sonnenfeld, the cinematographer on the Coens' first three films, had won a TV prize for "Pushing Daisies" at the guild honors and joined them afterward, meeting Brolin for the first time.

Brolin had everyone laughing as he shifted into an imitation of Jones' melodic drawl.

He had no idea that years earlier, Smith had suggested a sequel idea in which Agent J travels back in time and encounters the younger incarnation of Jones' stone-faced Agent K.

When it came time to shoot "Men in Black 3," that was the story-line, and Sonnenfeld knew just the right guy to call.

"Barry was like, 'Hey, Brolin! You want to be in "Men in Black"? It's fun!' And I was like, 'Yeah, I love "Men in Black." But as what? Like, Agent Q or Agent Whatever?'" Brolin said. "And Barry said, 'No, to play young Tommy! Remember, you did that impression for me?'

"There's one thing about being out at a bar with Barry and doing stupid impressions of Tommy Lee Jones with the Coens, and then there's another thing where somebody's telling you to do a movie that's going to be screening all over the planet."

Brolin, 44, has taken on tough interpretations before, earning acclaim as President George W. Bush in "W." and receiving an Academy Award nomination for "Milk" as San Francisco city supervisor Dan White, the man who killed fellow supervisor Harvey Milk and Mayor George Moscone.

But Brolin said doing a credible take on Jones' Agent K may have been the most-challenging acting job he's had, requiring subtle humor as straight man to Smith while making the younger K his own man and not just a caricature.

Brolin holed up at a Mexican hotel practicing his Agent K routine syllable by syllable, eventually going out to restaurants there and speaking like a young Jones.

"Then, once I felt like I had conquered Mexico, I could come back to California and try it on a few people here, see if that worked, then try it on my friends," Brolin recalled. "Then I'd go through half days of doing nothing but Tommy."

"Men in Black 3" is the third movie featuring Jones and Brolin, after "No Country" and "In the Valley of Elah." The movie begins and ends in present times, with Smith's J, as always, trying to draw out Jones' taciturn sad-sack K. The mid-section sends J back to 1969, where a nasty alien plots to kill Brolin's young K so he can carry out an invasion of Earth in the future.

Sonnenfeld has vivid memories of that night with the Coens, when he first met Brolin. What struck Sonnenfeld more than Brolin's Jones impersonation was a physical feature the two actors share.

"What I remember," said the director, "is, oh my God, this man is the only person on the planet that has a head as physically as huge as Tommy Lee Jones."