In many legal conflicts the fact that a defendant acted on the advice of competent legal counsel is considered an affirmative defense, or at least a mitigating factor.
Can such a defendant hide behind attorney-client privilege to lie about advice his attorney provided? I.e., does an attorney have an obligation to object to such a lie if made aware of it (even though that would amount to accusing his client of perjury)? Or, can an attorney be put under oath and compelled to testify against his client in such an event?
Clarification: This is not pertaining to a situation in which the Client is antagonizing the Attorney. Suppose, rather, that the Client at some point asked of the Attorney, "Give me your professional advice on X." The Attorney responds with, "My advice is Y." The Client instead does Z, gets into legal trouble, and in his defense claims, "My Attorney advised in scenario X to do Z."