Gov. Phil Murphy's pick for New Jersey's top law enforcement job got swift legislative approval Tuesday, hours after Murphy took office.

Former Bergen County Prosecutor Gurbir Grewal became the nation's first Sikh state attorney general after the state Senate approved his nomination with a vote of 29-0. He was later sworn into office at a private ceremony.

Grewal, 44, is a first-generation New Jersey resident, born to Indian immigrant parents in Jersey City and raised in Hudson and Bergen counties.

"I never imagined that my life's journey could bring me here today," Grewa. said during his confirmation hearing in front of the Senate Judiciary Committee on Tuesday.

Grewal, a registered Democrat, was made Bergen County's top law enforcement official by Gov. Chris Christie in 2016. Before that, he worked as chief of the economic crimes unit at the U.S. Attorney's Office under former federal prosecutor Paul Fishman.

Grewal told lawmakers he would continue the Attorney General's Office's efforts to stem the opioid crisis and improve relationships between police and the communities they serve.

He said he would direct the Division of Criminal Justice, the office's prosecuting arm, to work with prosecutors in the state's 21 counties to coordinate response to the heroin epidemic.

Grewal also said he would have the Division of Law, the civil side of the office, aggressively pursue environmental and consumer protection cases.

At a press conference last month announcing Grewal's nomination, Murphy, a Democrat, said he wanted an attorney general who would grapple with President Donald Trump's administration.

Former Gov. Chris Christie was a friend and informal adviser to the president, and under his Attorney General Christopher Porrino, the office often remained on the sidelines as attorneys general in nearby left-leaning states sued over immigration enforcement and civil rights issues.

"In light of all that is being thrown at us by the president, we need an attorney general unafraid to join our fellow states in using the law to protect all New Jersey residents," Murphy said at the time.

At his hearing Tuesday, Grewal was praised by lawmakers of both parties, including state Sen. Gerald Cardinale, a Republican from the prosecutor's home county of Bergen, who called him "an independent thinker."

"I have every confidence that you're going to advise this governor of what he can do, what he can't do and, maybe, what he should not do," Cardinale said.

NJ Advance Media staff writer Brent Johnson contributed to this report.

S.P. Sullivan may be reached at ssullivan@njadvancemedia.com. Follow him on Twitter. Find NJ.com on Facebook.