California reached an agreement with the federal government that the state's National Guard troops will deploy to the border to focus on fighting transnational gangs as well as drug and gun smugglers.

The announcement comes after a week of uncertainty in which President Donald Trump bashed the governor's insistence that troops avoid immigration-related work.

Some troops may be deployed this month and are expected to stay until at least Sept. 30, Brown said. They will be assigned to all parts of the state, not just the border.

SACRAMENTO, Calif. (AP) — California reached an agreement with the federal government that the state's National Guard troops will deploy to the border to focus on fighting transnational gangs as well as drug and gun smugglers, Gov. Jerry Brown said. The announcement comes after a week of uncertainty in which President Donald Trump bashed the governor's insistence that troops avoid immigration-related work.

Homeland Security Secretary Kirstjen Nielsen wrote on Twitter that final details were still being worked out "but we are looking forward to the support."

Brown said Wednesday he secured federal funding for terms similar to those outlined in last week's proposed contract: The Guard cannot handle custody duties for anyone accused of immigration violations, build border barriers or have anything to do with immigration enforcement.

Federal officials refused to sign the proposal because they said it was outside established protocol for the Guard.

Brown's office said Wednesday that the previous contract was unnecessary after he secured federal funding for his goals. Brown spokesman Evan Westrup said the exact cost hasn't been determined.

Some troops may be deployed this month and are expected to stay until at least Sept. 30, Brown said. They will be assigned to all parts of the state, not just the border.

Brown elicited rare and effusive praise from Trump last week when he pledged 400 troops, which helped put the president above the lower end of his threshold of marshaling 2,000 to 4,000 troops for his border mission.

Federal officials said Monday that Brown refused to commit California Guard troops to some initial jobs that were similar to assignments in the three other border states — Arizona, New Mexico and Texas — all governed by Republicans. Trump bashed Brown's position two days in a row, even as the governor said a deal was near.

"There's been a little bit of back and forth, as you always get with bureaucrats but I think we can find common understanding here," Brown said Tuesday in Washington. "There's enough problems at the border and the interface between our countries that California will have plenty to do — and we're willing to do it."

Nielsen, appearing alongside Arizona Gov. Doug Ducey to thank him for contributing 440 troops, said Wednesday there were 1,000 troops deployed on the border mission and that number is growing. She said they were performing aerial surveillance and vehicle repairs.