WASHINGTON — A deputy attorney general told the Senate Judiciary Committee on Tuesday that the Justice Department had begun working with Treasury officials and financial regulators to clarify how it legally deals with banks and other businesses that serve marijuana dispensaries and growers in states that have legalized the drug for medical or recreational use.

The deputy attorney general, James M. Cole, said the Obama administration was dedicated to enforcing federal drug laws and was choosing the best among a number of imperfect solutions by relying on states to regulate marijuana “from seed to sale.”

The hearing was the first aimed at sorting out differences between state and federal laws since Colorado and Washington State passed measures approving the recreational use of marijuana in November.

Those laws “underscored persistent uncertainty” about how the Justice Department resolves conflicts between state and federal marijuana laws, said Senator Patrick J. Leahy, the committee’s chairman.