When the day finally came, Cesar Vargas cried. His mother cried. His law professors cried.

His four-year legal fight to become a lawyer ended on Wednesday in a gilded courtroom in Brooklyn. There, Mr. Vargas, a 32-year-old Mexican immigrant without legal status, was sworn in along with 67 others as the newest members of the New York State Bar.

After the ceremony at the Appellate Division of State Supreme Court in Brooklyn Heights, Mr. Vargas, held the certificate of admittance he had purchased for $5 as proof, and embraced his mother, Teresa Galindo. She started weeping. So did he.

“Because,” Ms. Galindo, 72, said, “the child that I took by the hand crossing the border is now a lawyer.”

With immigration reform stalled in Congress and the president’s executive action to provide legal protections to some undocumented immigrants currently up for review by the Supreme Court, Mr. Vargas’s achievement offered hope for immigration activists.

“I see it as a victory personally for Cesar Vargas, but for immigrants everywhere, particularly for Dreamers, for those whose legal status is not of their own doing and who seek full inclusion in what is only their home, this country,” said Michelle J. Anderson, the dean of the City University of New York School of Law, who taught Mr. Vargas and witnessed the ceremony.

Ms. Anderson added, choking up, “He’s an amazing kid.”

The second youngest of eight children, Mr. Vargas was 5 when he crossed the border from Tijuana to San Diego.

He grew up on Staten Island and graduated from James Madison High School in Brooklyn. After law school, Mr. Vargas passed the New York State bar exam in 2011 on his first try. He applied for admission to the bar in 2012, but was rebuffed by the bar’s Committee on Character and Fitness because of his immigration status. His application was then referred to the Appellate Division of State Supreme Court.

In 2013 he gained temporary protection from deportation as part of President Obama’s program for children who came illegally with a parent and became an activist for immigration reform, founding the Dream Action Coalition.

In June, an appellate panel of the State Supreme Court voted unanimously to grant his bar application, making Mr. Vargas the first immigrant without legal status to be allowed entry into the bar. But there was a problem: He had been arrested in January 2015 while protesting during a political program in Iowa, interrupting Gov. Chris Christie of New Jersey.

Mr. Vargas was sentenced in June to a year of probation, which was cut to six months in December. His record was expunged, clearing the way for admission to the bar.

“I must admit, there were moments where I felt defeated; there were moments where I thought I was not going to be a lawyer,” Mr. Vargas said at a news conference in the cafeteria of his undergraduate alma mater, St. Francis College.

Jose Perez, the deputy general counsel of Latino Justice PRLDEF, a legal advocacy group that represented Mr. Vargas, said Mr. Vargas was already an example. The general counsel of the Utah State Bar called Mr. Perez recently, asking him what to do in similar cases in which students were undocumented.

“They realize that the Legislature doesn’t necessarily need to act, that typically in their state the judiciary determines bar admission and eligibility,” Mr. Perez said.

On Wednesday, before swearing in the 68 lawyers standing in front of him, Justice Randall T. Eng said that he was brought to the United States from China as an infant, which proved that birthplace was not an obstacle. He then asked how many of the lawyers had been born outside the United States. At least eight people raised their hands.

Mr. Vargas was touched by Justice Eng’s speech. “It was like he paraphrased the decision,” Mr. Vargas said, referring to the June decision in which the appellate court wrote: “Mr. Vargas’ undocumented immigration status, in and of itself, does not reflect adversely upon his general fitness to practice law. No matter where you are born, you can be a lawyer.”

Mr. Vargas is now a Latino-outreach strategist for Senator Bernie Sanders of Vermont, who is seeking the Democratic presidential nomination. Mr. Vargas will not be practicing law until after the November elections because he is busy on the campaign trail. Yet despite the day’s celebrations, with tamales his mother made, he said his future wasuncertain.

“I could still be deported any time,” Mr. Vargas said in a quiet moment. “If Trump was elected, he could deport me and my family. I am still undocumented.”

Correction:Feb. 3, 2016

An earlier version of this article erroneously attributed a distinction to Cesar Vargas. While he was one of the first immigrants without legal status in New York State to be sworn in as a lawyer, he was not the first. The mistake was repeated in a post on Twitter.

A version of this article appears in print on , Section A, Page 18 of the New York edition with the headline: An Immigrant’s Four-Year Fight to Become a Lawyer Ends in Celebrations. Order Reprints | Today’s Paper | Subscribe