Greyhound Lines will no longer allow Border Patrol agents to conduct immigration checks on its buses without warrants, the company announced on Friday — one week after a leaked government memo revealed that agents could not board buses without consent.

The memo appeared to take Greyhound by surprise. For years, the company, the largest operator of intercity buses in America, had been allowing border agents to board its vehicles without warrants, citing a law that it said it didn’t agree with.

“C.B.P. searches have negatively impacted both our customers and our operations,” the company said in 2018, referring to Customs and Border Protection, the Border Patrol’s parent agency. “Greyhound does not coordinate with C.B.P., nor do we support these actions.”

But in the leaked memo, which was first reported by The Associated Press, the Border Patrol chief confirmed that agents were prohibited from boarding buses and questioning passengers without warrants or the company’s consent.