Alameda and San Mateo counties won millions of dollars for homeless housing Thursday, as Gov. Gavin Newsom doled out the last round of state funding through Project Homekey.

Alameda County received more than $23 million for two projects totaling 165 units. Both sites will be used temporarily as interim housing for homeless residents, and then turned into permanent studio units by the fall of 2022.

San Mateo County won more than $33 million for two projects that will provide 170 units of interim housing. County spokeswoman Michelle Durand said she couldn’t disclose further details about the projects Thursday, as negotiations to acquire the buildings weren’t complete.

Funding also went to projects in Sacramento, West Sacramento, Marin County, Los Angeles County, Fresno and Tahoe.

“Today, we make the final round of awards creating 982 units across the state at a cost well below the average of what it typically takes to build new units,” Newsom said, according to a news release. “This program is an example of what’s possible when we think outside of the box, work together across government and put the needs of those most vulnerable among us first.”

Project Homekey represents phase two of Newsom’s plan to move the state’s homeless residents off the streets and out of crowded shelters to protect them from COVID-19. The first step was Project Roomkey, which temporarily moved more than 22,000 people into hotels throughout the state. But with federal funds for those rooms poised to dry up, many are closing soon.

Project Homekey — which helps cities and counties buy hotels, apartments and other buildings and turn them into long-term homeless housing — is intended to be a more permanent solution. Newsom has doled out more than $835 million for 93 projects that will provide 6,055 new units of housing throughout the state.

Newsom initially launched the program with $600 million, but that pot of money was quickly used up as applications poured in. Last Friday, he announced an additional $200 million for the fund — $17.5 million of which went to two projects in Oakland.

Using that money, Oakland will turn the 22-unit Inn at Temescal hotel into housing for homeless veterans. And the city will turn an 82-unit single-room-occupancy hotel on Franklin Street into housing for people recently released from jail or prison.

“With these two projects, Oakland just created more than 100 new units of housing for our unsheltered residents, and with a special priority to take care of our American heroes — our veterans,” Mayor Libby Schaaf said, according to a news release. “Our city staff works tirelessly to end homelessness in our streets, and I’m grateful for Gov. Newsom’s leadership and his partnership, as we all work together to urgently address this crisis.”

Homekey awards also have gone to San Francisco, Santa Clara County, Mountain View, San Jose and Contra Costa County.