ALONG THE SAN DIEGO-TIJUANA BORDER — For all practical purposes, the purple-and-white stucco shrine that Jose Arias built to celebrate his recovery from a heart attack and honor his family lies in Mexico.

The only way in and out of his plywood shack is through one of Tijuana's oldest neighborhoods, a patchwork of dirt and paved roads where dogs roam freely and the sounds of roosters and power tools fill the morning air. The shrine's backside once rested against a wall separating the U.S. and Mexico, blocking passage to San Diego.

But, according to the U.S. Border Patrol, Arias' structure encroaches on U.S. soil, posing a dilemma for the Trump administration as it pursued a $147 million replacement of 14 miles (22.5 kilometers) of barrier stretching east from the Pacific Ocean: Should the shrine be saved or destroyed?

The U.S. faces a similarly delicate dance as it charts a course to extend or replace barriers that blanket nearly one-third of the border. The path of the San Diego replacement cuts through a gated Tijuana subdivision of luxury homes with pink stripes on Spanish tile roofs to mark the official border. It collided with old trees that sprout on the Mexican side.

The Rio Grande marks the border between Texas and Mexico, ensuring that any land barrier on the U.S. side creates space between the wall and demarcation line established in bilateral treaties. One treaty limits construction on the Rio Grande flood plain, trapping homes in a no man's land between a wall built in the 2000s and the river.

Sometimes, soil and rugged terrain prohibit walls right on the border. In other areas, the Border Patrol wants space to access the Mexico-facing side for maintenance and repairs.

Rodney Scott, the Border Patrol's San Diego sector chief, initially thought the shrine was doomed but he sympathized with Arias as he learned more about it and a nearby shack belonging to Arias' daughter.

"They're doing the best that they can with what they have," he said. "There was no malice, there's no intent. There was really no reason that they would understand that they couldn't build right up to the border."

Yuli Arias, left, stands near a newly-replaced section of the border wall as her mother, Esther Arias, center, stands in the family's house that was once threatened by construction along the border in Tijuana, Mexico on Jan. 16, 2019. Gregory Bull / AP

Arias moved to Tijuana in 1957 from central Mexico and settled in Colonia Libertad, a neighborhood where residents crossed — unimpeded and illegally — to work or play soccer and baseball in San Diego. "It was a free pass," Arias said.

He and his wife raised 14 children at the home they bought in 1978; he turned its dirt floors to wood and added a second level. In the 1980s, illegal crossings were so rampant that street vendors set up outside his house to sell clothing, shoes and other goods, as well as chicken mole, Mexican stews and tequila. Arias even opened a slow-cooked pork taco stand.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

Illegal crossings slowed after an amnesty granted during the Reagan administration, and Arias returned to full-time construction work.

Scott, who grew up in the border town of Nogales, Arizona, where his father commuted to work at a Mexican factory, became a Border Patrol agent in 1992 and was assigned to a station a few miles from Arias' home. Thousands would gather on U.S. soil on a nearby soccer field and run past agents when night fell. Other large groups rushed inspection booths at a nearby border crossing.

Scott estimates that nine of 10 crossers eluded capture.

"We were arresting thousands of people in an eight-hour shift routinely and watching thousands more get away," he said.

The first stretch of border wall was built in San Diego in the early 1990s, made of corrugated steel matting used by the military as temporary runways. In 1994, the Border Patrol cracked down with more agents and orders not to cede an inch of ground to anyone crossing illegally. In the mid-2000s, a steel-mesh fence formed a second barrier, much of it topped with coiled razor wire.

Border Patrol arrests in San Diego plummeted 96 percent from nearly 630,000 in 1986 to barely 26,000 in 2017. A factory outlet mall with upscale brands opened on the border, near new homes that sell for more than $500,000. An area called "Smuggler's Gulch" became nearly impenetrable.

Scott described San Diego's transformation to President Donald Trump on live television when he toured border wall prototypes in March. Trump repeatedly touts San Diego as evidence that walls work, most recently in his State of the Union address on Tuesday.

The crackdown pushed illegal crossings to less-patrolled and more remote Arizona deserts, where thousands have died in the heat. Border Patrol arrests in Tucson in 2000 nearly matched San Diego's peak. Critics say Trump's argument is undermined by the fact that building a wall in one spot will mean that migrants will find an opening elsewhere.

Scott said the Border Patrol had to start somewhere, and San Diego was the busiest corridor for illegal crossings by far in the early 1990s.

"It wasn't, 'Do it in San Diego and stop.' It was, 'Let's prove what works and then let's copy it on the southwest border so we can improve security for the whole United States,'" Scott said.

Trump inherited 654 miles (1,053 kilometers) of barriers, mostly built from 2006 to 2009, and has awarded $1 billion in contracts, almost all of it to replace existing wall. Work on his first addition starts this month — 14 miles in Texas' Rio Grande Valley. He wants another $5.7 billion for more than 200 miles (322 kilometers), but Democratic leaders in Congress have offered nothing, an impasse that led to a five-week partial government shutdown.

A contract awarded in December will replace San Diego's steel-mesh barrier, which worked like a fortress a decade ago but is regularly breached with powerful battery-operated saws only recently made available in home improvement stores.

The Border Patrol is almost finished replacing the first layer with steel bollards up to 30 feet (9 meters) high. Agents couldn't see through the old fence, which was only about 10 feet (3 meters) high. A Mexican highway rose above the fence at one point and cars that ran off the road occasionally tumbled over it into the United States.

The U.S. State Department and U.S. delegation to the International Boundary and Water Commission are working with Mexico on one of the few unfinished areas — the luxury homes and a tennis court that poke into the U.S., Scott said. From a distance, they look like guest quarters.

The U.S. government, coordinating with Mexico, removed some trees in Tijuana because trenches for the new barrier might sever their roots, causing them to die and possibly fall, Scott said.

Arias built his shrine about 15 years ago to celebrate his health and, later, to honor his wife and son, both deceased. Behind a locked glass case, there are family photos, a framed portrait of the Virgin of Guadalupe, a ceramic angel, artificial flowers and a beer can and a bottle.

The Border Patrol decided the shrine could stay, although it needed a different base to avoid falling into new trenches. Officials say the shrine extends up to one foot into the U.S.

"A lot of times border security is seen as adversarial and it's really not," Scott said after chatting with Arias' daughter through the new bollards. "Compassion and law and order can go together, and I think they do go together."

Arias, now 84 with a shock of white hair, questions the wisdom of spending money on a barrier instead of schools and health care but acknowledges the U.S. has a sovereign right. He considers the wall neither a plus nor a minus for his own home.

"Why do you build a fence around your house?" he said. "To protect it. The (U.S.) government is building a wall to protect their country."

Arias and his daughters are deeply grateful to the Border Patrol.

"They respected my shrine," Arias said.