A married military couple who had to pay thousands of dollars to boot their tenants in order to move back into their Oakland home say the city law requiring the fee violates their rights.

The Pacific Legal Foundation, a libertarian property-rights firm based in Sacramento, said Wednesday in a federal lawsuit filed on behalf of the couple that the ordinance should be deemed unconstitutional and nullified.

The Oakland City Council in January enacted the ordinance as a way to assist tenants who are evicted. It was modeled on similar legislation of other rent-controlled cities in California.

A successful legal challenge could affect the laws on the books of those cities, too, including San Francisco, Berkeley and Los Angeles.

Under Oakland’s law, owners moving back into their homes typically must pay $6,500 for studios and one-bedroom apartments, $8,000 for two-bedroom apartments and $9,875 for those with three or more rooms. The payments, which adjust for inflation, go to the tenants to help them relocate.

In its complaint, the Pacific Legal Foundation alleged that tenants can use the money for whatever they want, not just relocation needs. The firm said it’s an improper government seizure of property.

In 2015, when the Air Force transferred Lyndsey and Sharon Ballinger from California to Washington, they began renting out their home in the Glenview neighborhood of Oakland to a couple who work as software engineers.

When the Ballingers were reassigned back to California this year, they gave the tenants a two-month notice and paid the more than $6,500 relocation fine. Their lawyer, Meriem Hubbard, called it a “substantial sacrifice for a young Bay Area family on a military salary.”

“The people who are renting out their homes, and especially the ones who want to move back into them, are not the ones who are creating the housing crisis,” Hubbard said. “People like the Ballingers shouldn’t have to pay to move back into their own home.”

Sharon Ballinger is now working as a nurse in the intensive care unit of the Travis Air Force Base medical center. Her wife, Lyndsey Ballinger, is a member of the National Guard. They are raising two young boys, Hubbard said.

By the time the Ballingers moved back to Oakland, the lease agreement had become a month-to-month one, and the contract was signed prior to the City Council enacting the ordinance, according to their complaint. But the ordinance still applied to them.

The suit alleges that the city law violates a number of constitutional rights as well as California’s Ellis Act, which allows property owners to take their units off the market.

Previous legal challenges to similar tenant-protection ordinances have seen mixed success. Courts struck down a San Francisco ordinance that would have required landlords to pay their evicted tenants as much as $50,000 but upheld the city’s $4,500 figure that went into effect in 2005 and adjusts for inflation.

City Councilwoman Rebecca Kaplan, who authored the Oakland ordinance, said there is a waiver for which owners can apply if they are unable to pay the relocation fees. Kaplan said she did not know the specifics of the Ballinger case but that only a small portion of owners need the waiver.

“The overwhelming majority of people who own rental property are not poor,” Kaplan said. “It’s really important to have a relocation assistance program. The vast displacement of tenants in Oakland and surrounding communities is a huge crisis.”

Kimberly Veklerov is a San Francisco Chronicle staff writer. Email: kveklerov@sfchronicle.com Twitter: @kveklerov