By Sharon Bernstein

SACRAMENTO, California (Reuters) - The federal government would need a warrant from a judge if it wants the cooperation of California officials in searching residents' cellphone and computer records, under a bill making its way through the state legislature.

The bill, which passed the state Senate with just one opposing vote on Monday, was introduced in the wake of information leaked by former National Security Agency contractor Edward Snowden showing massive internal surveillance of U.S. citizens by the NSA.

"The Fourth Amendment to the U.S. Constitution is very clear. It says the government shall not engage in unreasonable search and seizure," said the bill's author, Democratic State Senator Ted Lieu, of Torrance. "The National Security Agency's massive and indiscriminate collecting of phone data on all Americans, including more than 38 million Californians, is a threat to our liberty and freedom."

The California bill is the farthest along of several such measures that have been introduced in eight states, according to Lieu's spokesman Jeff Gozzo, including Alaska, Arizona and Oklahoma.

It comes as Congress wrestles with a similar bill at the national level.

A federal judge ruled last year that the National Security Agency's practice of gathering so-called meta-data on U.S. residents was likely unconstitutional, but the ruling is being appealed by the Obama administration.

The California bill would not allow law enforcement and other officials in the most populous U.S. state to assist federal agencies looking for records of phone calls, Internet use or other electronic activity by residents unless a warrant has been issued by a judge.

It was opposed by the California District Attorneys Association, which said the bill was too vague.

(Editing by Lisa Shumaker)