SACRAMENTO, Calif. (AP) — Gov. Jerry Brown has signed legislation making California the fifth state to allow judges to declare a child has more than two legal parents.

Current law allows courts to acknowledge only two people as parents, which advocates say does not give judges any leeway to exercise judgment.

SB274 by Democratic Sen. Mark Leno of San Francisco allows a judge to legally recognize additional parents if failing to do so would be detrimental to a child.

Leno's bill was prompted by a 2011 court case involving a California girl whose legal parent could not care for her and whose biological father was deemed not a parent. She ended up in state custody when her birth mother was incarcerated and her other legal parent was hospitalized.

Brown vetoed similar legislation last year.