David Cruz Hernandez felt euphoric as he cleared tables at a restaurant in June 2012. News was breaking of President Barack Obama’s effort to shield from deportation hundreds of thousands of people who were brought to the country as children, while giving them access to work permits.

For Cruz Hernandez, then a 23-year-old UC Santa Cruz student, the program called Deferred Action for Childhood Arrivals, or DACA, seemed a solution to his life of uncertainty. He raced home that night and pulled up the eligibility rules on his iPad in bed.

Applicants must have arrived in the U.S. before June 2007. Check. They must be in school. Check. They must have entered the country before their 16th birthday.

“Oh,” he said to himself. He had crossed the border when he was 16 years and 9 months old.

Five years later, Cruz Hernandez remains anguished by his narrow miss. And he is part of a large group of people who have graduated from a California university or are on the path toward graduating, despite having no legal status, no pathway to a work permit and no protection from deportation.

These students are similar in profile to the “Dreamers” who qualified for DACA — who number more than 200,000 in California — but face dwindling options on graduation day, even though they arrived as juveniles and were provided strong educations, often with taxpayer-funded aid.

Their plight illustrates the divide between state and federal approaches to immigration enforcement, especially under President Trump, who is seeking to dismantle sanctuary policies and build a wall at the southern border because he says illegal immigration is dangerous and hurts the economic prospects of legal citizens.

“There is no doubt that without administrative relief — in the form of deferred action and employment authorization or broad federal relief — their prospects are greatly diminished,” said Pratheepan Gulasekaram, a professor and immigration law expert at Santa Clara University. “That’s a shame for them and for us — it’s educated, productive young people being kept out of the workforce.”

For Cruz Hernandez, the difference of nine months is profound.

After finishing at UC Santa Cruz, he went on to San Francisco State, where he recently graduated with a master’s degree in molecular biology. But instead of perhaps seeking a biotech job in the Bay Area, he’s decided to depart his home in San Francisco for a prestigious university in England, where he will pursue a doctorate.

He knows he may never again see his parents, who are undocumented farmworkers in California. But without a work permit and assurance that he’ll be safe in the country, he feels he can’t stay.

“It’s heartbreaking,” he said. “But I have to leave — otherwise it’s going to be the same. I cannot depend on the government to accomplish my dreams. I need to do something.”

Advocates for Bay Area immigrants say Cruz Hernandez’s story is not unusual. As the Trump administration has ramped up immigration enforcement across the country, they said, many of these students are increasingly worried about their very existence in the country.

“Every day you have to think twice before you go outside — you just want to go to class, go home and stay in the same area,” said Alejandro, a junior at UC Berkeley who is undocumented and did not qualify for DACA because he arrived in the country in 2008 at the age of 13. “I have dreams about being deported.”

Valeria, a student at Santa Clara University studying engineering, came to the country with her family in 2011, when she was 16. Like Alejandro, she asked to be identified only by her first name, because she fears being targeted by immigration agents.

“I am overly vigilant now,” she said. “I am afraid of getting stopped or speaking out.”

This group is difficult to quantify. California public colleges, including community colleges, had between 74,800 and 87,000 undocumented students in 2017, according to estimates from the nonprofit Campaign for College Opportunity.

Katharine Gin, executive director of Educators for Fair Consideration, a San Francisco group that helps undocumented students pursue college degrees and careers, said up to 20 percent of undocumented students in four-year California colleges and universities — and a higher percentage in community colleges — are not eligible for DACA.

Nationwide, more than 300,000 individuals, including Alejandro, could have qualified under an expanded version of DACA that Obama sought in 2014. That program pushed the year of arrival to January 2010, but was blocked in federal court.

In any event, California is home to many students who may have to retreat deeper into the shadows after graduation, unable to fully tap their education, experts said.

“It doesn’t make a lot of sense that federal law would prevent the public from benefiting from that investment,” Gulasekaram said.

To proponents of tougher immigration policies, the quandary has little to do with the federal government and everything to do with decisions made by undocumented students, their families, and states that protect them and encourage them to seek an education. Some states, such as Georgia, block access to public colleges for students who are in the country illegally.

Jessica Vaughan, director of policy at the Center for Immigration Studies in Washington, which favors more restrictive immigration policies, said the criteria for DACA was “always arbitrary.” Expanding the program, she said, would bring more competition to American citizens for educational opportunities and jobs.

“I think it’s unfortunate that the DACA program gave people in that situation an expectation that they too would be able to stay and work here,” she said. “Awarding more people a benefit that is not grounded in law is not going to help the situation.”

Many graduates who aren’t eligible for DACA have decided to work in lower-paying jobs that don’t require proof of citizenship. This group includes Emilio, 37, who graduated with a double major from UC Berkeley and a master’s degree from San Jose State in urban planning, but has no work permit or status.

Emilio, who asked to be identified by a pseudonym, came to the country at age 15 but was ineligible for DACA because he was 32 when it was announced — two years too old. He would have qualified under Obama’s expanded DACA program, which eliminated the age requirement.

These days, he works in a Bay Area restaurant, with his professional dreams on hold for the foreseeable future.

“It is just part of life,” he said, “Some people have to take a longer path to get where you want to be and accomplish your goals. I have been preparing in school for that opportunity.”

Others try different paths, such as working as independent contractors or even starting their own businesses.

“The opportunities are limited,” Gin said. “It’s a source of hope but in the grand scheme of things, it’s limited.”

For Cruz Hernandez, now 28, the days of waiting for immigration reform are over. He decided to leave the U.S. more than a year ago, but his choice was reinforced after the 2016 election.

In recent months, he has tried to brace his parents to the idea of him leaving, often dropping hints he might go somewhere else one day. Two weeks ago, on a visit home, he finally told them of his plans.

“Dad,” Cruz Hernandez said to his father as he sat on the couch, “I’m going to go abroad to pursue my education because I’m not going to make it here.”

His father, a day laborer who worked long hours to provide for the family, sat quietly, his eyes closing and opening, his throat swallowing over and over.

His mother, who has also worked for years picking fruit, looked at him and said, “You have to do whatever you have to do to continue your career.”

Hamed Aleaziz is a San Francisco Chronicle staff writer. Email: haleaziz@sfchronicle.com Twitter: @Haleaziz