Two weeks: That's how quickly a foreign technology worker in Silicon Valley can get an employment permit from Canada. In the U.S., that process takes months.

As the administration of President Donald Trump has increased scrutiny of H-1B visas for skilled foreign workers and plans to ban their spouses from holding jobs in the U.S., Canada has been moving aggressively to suck top foreign talent out of Silicon Valley and other technology-rich regions of the U.S.

The Canadian government won't say if it's capitalizing the tumultuous and uncertain immigration climate in the U.S. But experts say Canada's year-old "Global Skills Strategy" program, which offers work permits similar to America's H-1B visa, is ideally structured to attract highly skilled foreign tech workers to Toronto, Montreal or Vancouver. Though immigrants make up just 20 percent of Canada's population, they hold about half of the science, technology, engineering and math degrees at the bachelor's level and above, government figures show.

Before the program launched, Canada's employment permit process for skilled workers took months.

"It captures all of the Silicon Valley people, and it captures them quickly," said Asha Kaushal, a professor at the University of British Columbia law school who studies immigration law.

Trump's plan to overhaul the H-1B — a visa intended for the kind of skilled workers Silicon Valley companies rely on but attacked by critics as a tool to replace American workers with cheaper foreign labor — has ratcheted up anxiety levels and created uncertainty for many skilled foreign tech workers in the U.S.

Former Bay Area software developer and Indian citizen Shobhit Khandelwal has already moved to Toronto. He came to work for note-taking app firm Evernote in Redwood City in February 2017, with a master's in operations research from Columbia University, experience at Citibank and e-commerce company Jet.com, and an H-1B visa. Eighteen months later, he left.

"I wanted to work on my own startup and I didn't want to wait another 20 years or 30 years to get a green card," said Khandelwal, 28, who acknowledged that the uncertain climate for immigrants in the U.S. also played a role in his decision. "I thought about, if I do a startup (in the U.S.), if I can't get the right kind of talent, how can I build a company?"

Rather than simply get a work permit, Khandelwal opted to obtain permanent residence in Canada — the equivalent of a U.S. green card. It took about six months. In the U.S., Indian H-1B workers like him wait years, if not decades, for a green card.

Uncertainty about U.S. visas and long waits for green cards were causing a brain drain in Silicon Valley long before Trump's election. But experts say the current climate has made Canada more appealing for some foreign workers.

Matthew Kolken, a New York immigration lawyer whose firm helps clients immigrate to both Canada and the U.S., said he's had about a dozen foreign-citizen clients decide to move to Canada.

"They gave up on their American dream," Kolken said. "You want to be able to plan your career and your future. Why would you put your entire career potentially on hold if you have a viable opportunity in a country that has open arms to you?"