CVS Caremark Corp named a recent Wal-Mart Stores Inc executive as the president of its retail pharmacy business, but a judge temporarily blocked him from taking the job due to a noncompete agreement with Wal-Mart.

Wal-Mart's lawsuit seeks to bar the appointment of Hank Mullany, who served as president of the discount retailer's northern U.S. division until November 5. In the lawsuit against CVS and Mullany, filed in Delaware Chancery Court late on Thursday, Wal-Mart said the move would violate the noncompete agreement.

The hiring battle comes as Wal-Mart tries to compete more directly with retailers such as CVS by opening smaller stores of its own.

Certainly Wal-Mart is one of their biggest competitive threats on the retail side, I think, both on the pharmacy side and somewhat less on the front end, Morningstar analyst Matthew Coffina said of CVS. With this talk of Wal-Mart moving to a smaller format with urban stores, that competitive threat will probably increase.

CVS said the lawsuit is without merit, and that Mullany's agreement with Wal-Mart should not prevent him from working for the drugstore chain.

CVS is seeking to employ Mullany as of December 6, but Delaware judge Travis Laster granted a temporary restraining order preventing Mullany from working for CVS until a December 15 court hearing.

Wal-Mart said it was suing to enforce the noncompete agreement and prevent Mullany's employment with CVS, one of the largest U.S. pharmacy chains along with Walgreen .

Mullany did not respond to a request for comment.

As a Wal-Mart executive vice president, Mullany oversaw more than 1,300 stores in 19 states, the lawsuit says. He was also overseeing the company's push into urban and rural markets by opening stores that are less than one-fifth the size of its traditional format.

Mullany's extensive and intimate knowledge of Walmart's highly secret business strategies will necessarily be used and disclosed during his employment by CVS, and indeed, may have been why CVS hired him in the first place, said the complaint.

Former Wal-Mart general counsel Robert Rhoads said the company's philosophy was to always try to negotiate a deal before filing a lawsuit.

But when it comes to executive poaching, if a settlement is not possible, then the company must send a message to competitors that it will not hesitate to enforce its rights, said Rhoads, who left the company in 2002.

If someone threatens you, the first thing you do is call up and say: 'What's up with this,' Rhoads said. But it doesn't mean you roll over.

If Mullany joins CVS he would take over a unit that has been the industry leader in pharmacy retail, Coffina said. The company has been slowed in recent years by its underperforming pharmacy benefits manager business, which administers prescription drug benefits for employers and health plans.

Wal-Mart, the world's largest retailer, has also struggled with increased competition from lower-priced dollar stores in the sluggish economy and is hoping to rebound after six straight quarters of falling sales.

Mullany would succeed Larry Merlo, who was promoted to president of CVS Caremark and is due become the chief executive when current CEO Tom Ryan steps down.

Coffina added it would have reflected better on CVS if the company had hired someone from within its own ranks.

In general, you'd rather see them building up people within the CVS culture, he said. But that said, he certainly has a fair amount of relevant experience that he would be good in that role.

CVS shares rose 1.4 percent to close at $32.42 on Friday.