BOSTON — Gay and lesbian couples from outside Massachusetts are now free to marry in the state.

Gov. Deval Patrick has signed a bill repealing a 1913 law that barred couples from marrying in Massachusetts if their union would not be valid in their own states.

Out-of-state gay couples will be able to marry immediately if a court waives the state's standard three-day waiting period for them.

Opponents had said repealing the law would make Massachusetts the "Las Vegas of gay marriage." But Patrick says the old law had its roots in racism as it was seen as a way of preventing interracial marriages.

The new law includes a provision waiving the customary 90-day waiting period for the change to go into effect.